I have been working through your book and I am currently having trouble getting the page to send me an email when it loads. (page 310 Chap 4).
I have an email address set up with my domain and I can send and receive emails with it so I know that it is configured correctly and works however when I reference the smpt client it is generating errors I believe.
The error is:
"
The remote name could not be resolved: 'smtp.parkerdsgn.com'"
And the stack trace is:
Code:
[WebException: The remote name could not be resolved: 'smtp.parkerdsgn.com']
System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +5421675
System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +202
System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +332
System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +160
System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
System.Net.Mail.SmtpClient.GetConnection() +35
System.Net.Mail.SmtpClient.Send(MailMessage message) +1213
[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
Email.Page_Load(Object sender, EventArgs e) in C:\BegASPNET\Site\Demos\Email.aspx.vb:14
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
But my smtp server is smtp.parkerdsgn.com so I am not sure whats wrong?
The code I have in my
vb file is:
Code:
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 Will"
myMessage.From = New MailAddress("[email protected]", "xxxxxx")
myMessage.To.Add(New MailAddress("[email protected]", "xxxx"))
Dim mySmtpClient = New SmtpClient()
mySmtpClient.Send(myMessage)
Any help would be good, cheers.