Sending e-mail from ASP.NET form (VB) Print

  • programming, send email, web form
  • 3

Try

Dim SmtpClient As New Net.Mail.SmtpClient("mail.negox.com", 587)
SmtpClient.EnableSsl = True
SmtpClient.Credentials = New Net.NetworkCredential("name@your-domain.com", "password")
Dim MailMessage As Net.Mail.MailMessage = New Net.Mail.MailMessage()

MailMessage.From = New Net.Mail.MailAddress("name@your-domain.com")
MailMessage.To.Add(New Net.Mail.MailAddress("name@domain.com"))

MailMessage.Subject = "Subject Message"
MailMessage.Body = "Body Message"
SmtpClient.Send(MailMessage)

MailMessage = Nothing
SmtpClient = Nothing

Response.Write ("Sent Successfully!")

Catch ex As System.Exception

Response.Write ("Error: " & ex.Message)

End Try

Was this answer helpful?

« Back