Posted By

vikingdread on 01/14/10


Tagged

email aspnet


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

tanathos
Barlon
nickian
wizard04


Send Email Using Gmail in ASP.NET


 / Published in: ASP
 

URL: http://csharpdotnetfreak.blogspot.com/2009/08/send-email-using-gmail-in-aspnet.html

  1. Imports System.Net.Mail
  2.  
  3. Protected Sub Button1_Click
  4. (ByVal sender As Object, ByVal e As EventArgs)
  5. Dim mail As MailMessage = New MailMessage()
  6. mail.To.Add("[email protected]")
  7. mail.To.Add("[email protected]")
  8. mail.From = New MailAddress("[email protected]")
  9. mail.Subject = "Email using Gmail"
  10.  
  11. String Body = "Hi, this mail is to test sending mail"+
  12. "using Gmail in ASP.NET"
  13. mail.Body = Body
  14.  
  15. mail.IsBodyHtml = True
  16. Dim smtp As SmtpClient = New SmtpClient()
  17. smtp.Host = "smtp.gmail.com" //Or Your SMTP Server Address
  18. smtp.Credentials = New System.Net.NetworkCredential
  19. ("[email protected]","YourGmailPassword")
  20. smtp.EnableSsl = True
  21. smtp.Send(mail)
  22. End Sub

Report this snippet  

You need to login to post a comment.