Way back in 2001, I wrote
ASP.NET Email Using VB for ASP.NET 1.x. ASP.NET 2.0 now uses the
System.Net.Mail instead of the
System.Web.Mail Namespace.
Here is a quick snippet to get you started.
Dim Message As MailMessage = New MailMessage()
Dim Smtp As New SmtpClient()
'-- Build Message
Message.From = New MailAddress("larryking@cnn.com", "Larry King")
Message.To.Add(New MailAddress("oprah@oprah.com", "Oprah"))
Message.IsBodyHtml = False
Message.Subject = "Come on My Show Soon"
Message.Body = "Please be a guest on my show. - Larry"
'-- Send Message
'-- each web host is different
'-- (adjust next 2 lines accordingly)
Smtp.Host = "localhost"
Smtp.DeliveryMethod = SmtpDeliveryMethod.Network
Smtp.Send(Message)
If your web host requires that you send the email using SMTP Authentication read
Sending Email in ASP.NET Using SMTP Authentication (VB.NET).
Labels: ASP.NET, Email, VB.NET