How to send mail in ASP.NET using VB.NET

In this Blog you will learn how to send emails from you .aspx site. This step is be sure that the SMTP Server is locally installed at SMTP Service of the IIS.

Namespace

We use the below namespace.

Imports System.Web.Mail

 

SmtpMail class

this class has a method called Send that allows the user to send an email, in this way we set four parameters:

SmtpMail.Send("[email protected]","[email protected]","Rohatash","Hello World");

Now build your message.

Dim [To] As String = "[email protected]"

        Dim From As String = "[email protected]"

        Dim Subject As String = "Rohatash"

        Dim Body As String = "Hello World"

 

        SmtpMail.Send(From, [To], Subject, Body)