Header

Tuesday, 7 February 2012

How to send E-mail using vb.net Code



Here i am trying to send mail using Gmail free smtp.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Dim mail As New MailMessage()
Dim smtpserver As New SmtpClient("smtp.gmail.com")
mail.From = New MailAddress("your Gmail id")
mail.[To].Add("mail Id Where u want to send mail")
mail.Subject = "mail form pis"
mail.Body = "body message"
mail.IsBodyHtml = True
smtpserver.Port = 587
smtpserver.Credentials =
New System.Net.NetworkCredential("yourmailID", "password")
smtpserver.EnableSsl = True
smtpserver.Send(mail)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Thanks
Shailendra Singh

No comments:

Post a Comment