Posted by: Sourav | September 7, 2015

Send mail using vb.net


Try
Dim mail As New MailMessage()
Dim SmtpServer As New SmtpClient
SmtpServer.Credentials = New Net.NetworkCredential(“mailaddress”, “pass”)
SmtpServer.Port = 587
SmtpServer.Host = “smtp.gmail.com”
SmtpServer.EnableSsl = True
SmtpServer.EnableSsl = True
mail.To.Add(“mailaddress”)
mail.From = New MailAddress(“mailaddress”)
mail.Subject = “Hello”
mail.Body = “Hello”
SmtpServer.Send(mail)
MessageBox.Show(“ok”)

        Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

Now the receiving mail user to go to

https://www.google.com/settings/security/lesssecureapps

and turn it on

Sourav Bhattacharya

vb.net faculty

9748184075

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: