I have seen others posting very similar questions and I apologize if I am simply rehashing an old problem, but I have not been able to find an answer to my problem yet.
I receive an error each time I attempt to open the Demos/Email.aspx page in the browser.
I do know that my mail server does allow me to send e-mails in this manner, as I have very similar setups on other sites (I'm actually taking on ASP.NET 3.5 to add to the repertoire), so I know the server is not the issue.
Following is the error:
Quote:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xx.xxx.xx.xx:xx
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xx.xxx.xx.xx:xx
Source Error:
Line 12: Dim mySmtpClient As SmtpClient = New SmtpClient()
Line 13: mySmtpClient.EnableSsl = True
Line 14: mySmtpClient.Send(myMessage)
Line 15: End Sub
Line 16: End Class
Source File: C:\BegASPNET\Site\Demos\Email.aspx.vb Line: 14
|
Following is web.config:
Code:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="xxxxx <[email protected]>">
<network host="mail.xxxxxxxxxx.xxx" userName="[email protected]" password ="xxxxxxxxxx" />
</smtp>
</mailSettings>
</system.net>
Following is Demos/Email.aspx.
vb:
Code:
Imports System.Net.Mail
Partial Class Email
Inherits BasePage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myMessage As MailMessage = New MailMessage()
myMessage.Subject = "Test Message"
myMessage.Body = "Hello world, from Planet Wrox"
myMessage.From = New MailAddress("[email protected]", "xxxxx")
myMessage.To.Add(New MailAddress("[email protected]", "xxxxx"))
Dim mySmtpClient As SmtpClient = New SmtpClient()
mySmtpClient.EnableSsl = True
mySmtpClient.Send(myMessage)
End Sub
End Class
I am hoping that I have a small typo that I am overlooking, but any help would be appreciated.