Hey,
How can I send e-mail from a ASP.NET (vb.net) form ?
Thanks !
Printable View
Hey,
How can I send e-mail from a ASP.NET (vb.net) form ?
Thanks !
Need to make a reference to System.Web.Mail namespace first.
VB Code:
Dim theEmail As MailMessage = New MailMessage() theEmail.To = "[email protected]" theEmail.From = "[email protected]" theEmail.Subject = "My email subject" theEmail.Body = "The body of the email" 'Set the smtp server to use. Check with your hosting company. SmtpMail.SmtpServer = "mail.webhost4life.com" 'Send the email. SmtpMail.Send(theEmail)
Trap any errors while sending, so it can recover.