I am having difficulty getting the email demo to work.
Any insight into how to get around the issue would be very welcome. I was going to just continue with the book, but then the following chapter builds on the email issue.
When I try to run the demo, I get the following error:
No connection could be made because the target machine actively refused it
My ISP is Verizon, and on their website they say the following:
"The SMTP setting for outgoing mail is
outgoing.verizon.net."
Here is my code:
web.config:
<system.net>
<mailSettings>
<smtpdeliveryMethod="Network"from="me@verizon.net">
<networkhost="outgoing.verizon.net"userName="me"password="mypass" />
</smtp>
</mailSettings>
</system.net>
Email.aspx.cs:
publicpartialclassDemos_Email : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = newMailMessage();
myMessage.Subject = "Test Message";
myMessage.Body = "Hello world, from Planet Wrox";
myMessage.From = newMailAddress("[email protected]");
myMessage.To.Add(newMailAddress("[email protected]"));
SmtpClient mySmtpClient = newSmtpClient();
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(myMessage);
}
}
Thank you for any help you can provide.