Sending Email

Here is the code @vishal.kp

     Dim e_mail As New MailMessage()
    e_mail.From = New MailAddress(" FROM Mail ID")
    e_mail.[To].Add(" TO Mail ID")
    'e_mail.CC.Add(" CC mail ID")
    e_mail.Subject = "MAIL subject"

    Dim smtp As New SmtpClient(" SMTP server you want to use") 
    e_mail.Body = "BODY of the mail "
   smtp.Send(e_mail)

If you have any attachments to be sent in the mail, add these two lines of code

         Dim fileTXT As String = "Path of the file"
        Dim data As Net.Mail.Attachment = New Net.Mail.Attachment(fileTXT)
        data.Name = "The name of the file you want to display in the mail"

Do remember, before using the code , you need to import the mail package

Imports System.Net.Mail

4 Likes