Hello Friends

last days i was searching the internet and i found that we can use gmail account credential as a smtp server.

Here is the code for the how use gmail credential for sending a mail form the asp .net.

Create

Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim loginInfo As New NetworkCredential(gmailaccount, gmailpassword)
Dim msg As New MailMessage()
msg.From = New MailAddress(gmailaccount)
msg.To.Add(New MailAddress(”testing@yahoo.com”))
msg.Subject = “test gmail account test”
msg.Body = “hi arjun. nice code you gave to me thanks for the knowledge sharing.”
msg.IsBodyHtml = True
Dim client As New SmtpClient(”smtp.gmail.com”)
client.EnableSsl = True
client.UseDefaultCredentials = False
client.Credentials = loginInfo
client.Send(msg)
End Sub

Please use this code and tell me it will works for your or not.
Enjoy the code.

Tags:

This entry was posted on Friday, June 5th, 2009 at 3:06 am and is filed under .Net Emperor. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment