Amazon Affiliate

Saturday 18 May 2013

Sending Email in VB.Net

Sending mail in VB.Net      

            Dim mail As New MailMessage
            mail.Subject = "Subject of the message"
            mail.To.Add("receiver's mail id")  '
            mail.From = New MailAddress("Sender's mail id")
            mail.Body ="Message Body"
            Dim smtp As New SmtpClient("smtp.gmail.com")
            smtp.EnableSsl = True
            smtp.Credentials = New System.Net.NetworkCredential("Sender's mail id",        
            "password")
            smtp.Port = "587"
            smtp.Send(mail)
            MsgBox("Message Send Successfully", MsgBoxStyle.Information)

No comments:

Post a Comment