Hello
I am trying to learn these things from books so please excuse my lack of proper education.
In this book that I am reading it tells me to make sure IIS Default SMTP Virtual Server is running. Then I need to go to Access -> Relay Restriction and add 127.0.0.1 as IP Address Mask so my localhost has access Granted.
I tried the book code:
Imports System.Web.Mail
Private Sub SendEmail(ByVal ToAddress As String )
Dim msg As MailMessage
msg.From = "
[email protected]"
msg.To = ToAddress
msg.Subject = "Topic"
msg.Body = "Body Message"
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(msg)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click
Try
Me.SendEmail(txtEmail.Text)
Catch ex as Exception
Response.Write("Email Failed")
End Try
End Sub
-----------------------------------------------------------
Of course this doesn't run. I get "Email Failed".
The msg.From is valid and I am getting and able to send email from that account.
What step am I missing?
Thank you.