Send Mail From Gmail Using Vb.net Program

Try

Dim mail As MailMessage = New MailMessage()

mail.To.Add("yyyy@gmail.com")

mail.From = New MailAddress("xxxx@gmail.com")

mail.Subject = "Email using Gmail"

Dim Body As String = "Sending mail using Gmail's SMTP"

mail.Body = Body

mail.IsBodyHtml =
True

Dim smtp As SmtpClient = New SmtpClient()

smtp.Host = "smtp.gmail.com"

smtp.Credentials = New System.Net.NetworkCredential("xxxx@gmail.com", "xxxx")

smtp.EnableSsl = True

smtp.Port = 587

smtp.EnableSsl =
True

smtp.Send(mail)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

End

Comments

Popular posts from this blog

How to Stop Excel from giving a number in scientific notation

The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

System.IO.IsolatedStorage.IsolatedStorageException: Unable to create the store directory