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


Dim SmtpClient As New Net.Mail.SmtpClient("", 587)
SmtpClient.EnableSsl = True
SmtpClient.Credentials = New Net.NetworkCredential("", "password")
Dim MailMessage As Net.Mail.MailMessage = New Net.Mail.MailMessage()

MailMessage.From = New Net.Mail.MailAddress("")
MailMessage.To.Add(New Net.Mail.MailAddress(""))

MailMessage.Subject = "Subject Message"
MailMessage.Body = "Body Message"

MailMessage = Nothing
SmtpClient = Nothing

Response.Write ("Sent Successfully!")

Catch ex As System.Exception

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

End Try
  • programming, send email, web form
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

A Web Service example

In the following example we will use ASP.NET to create a simple Web Service that converts the...

Connection string for Web.config

connectionString="Data Source=IP-ADDRESS;Initial Catalog=YOUR-DATABASE;User...

Crystal Reports version

We have upgraded SAP Crystal Reports 2013 SP25 (Runtime Engine for .NET Framework 4) to SP26 for...

Enable error message for Web.config

To enable the details of this specific error message to be viewable on remote machines, please...

Redirect to HTTPS using Web.config

Add the source code following in system.webServer section (web.config): <rewrite>...