Return to Snippet

Revision: 22519
at January 14, 2010 05:23 by vikingdread


Initial Code
Imports System.Net.Mail
 
Protected  Sub Button1_Click
(ByVal sender As Object, ByVal e As EventArgs)
  Dim mail As MailMessage =  New MailMessage() 
  mail.To.Add("[email protected]")
  mail.To.Add("[email protected]")
  mail.From = New MailAddress("[email protected]")
  mail.Subject = "Email using Gmail"
 
  String Body = "Hi, this mail is to test sending mail"+ 
                "using Gmail in ASP.NET"
  mail.Body = Body
 
  mail.IsBodyHtml = True
  Dim smtp As SmtpClient =  New SmtpClient() 
  smtp.Host = "smtp.gmail.com" //Or Your SMTP Server Address
  smtp.Credentials = New System.Net.NetworkCredential
       ("[email protected]","YourGmailPassword")
  smtp.EnableSsl = True
  smtp.Send(mail)
End Sub

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

Initial Description

                                

Initial Title
Send Email Using Gmail in ASP.NET

Initial Tags
email, aspnet

Initial Language
ASP