Send Basic Email
Dim myMail As MailMessage = New MailMessage
myMail.From = "from@youremail.com" 'the "from" address
myMail.To = "to@theiremail.com" 'the "to" address
myMail.Subject = "Howdy" 'your "subject"
myMail.Body = "Just wanted to say Hi. How are you?"'message body
SmtpMail.SmtpServer = "localhost" 'the mailserver
'send the email
SmtpMail.Send(myMail)
myMail.From = "from@youremail.com" 'the "from" address
myMail.To = "to@theiremail.com" 'the "to" address
myMail.Subject = "Howdy" 'your "subject"
myMail.Body = "Just wanted to say Hi. How are you?"'message body
SmtpMail.SmtpServer = "localhost" 'the mailserver
'send the email
SmtpMail.Send(myMail)






Dim basicAuthenticationInfo As _
New System.Net.NetworkCredential("username", "password")
'Put your own, or your ISPs, mail server name onthis next line
mailClient.Host = "Mail.RemoteMailServer.com"
mailClient.UseDefaultCredentials = False
mailClient.Credentials = basicAuthenticationInfo
mailClient.Send(myMail)
This code will work in cases where the smtp server is local or remote on the machine your web site is running on.
The updated code looks like: