Lets Have a fun with Technology.

BTemplates.com

Follow by Email

Tuesday, May 26, 2009

send email using asp.net from gmail account


Hello Frd's

Below Code are For Sending Email From your gamil account to any other Account.It's Working Code you can directly run that Code Without Changing Any Value.

Or Change From , to , NetworkCredential

Code :-

MailMessage msg = new MailMessage();
msg.From = new MailAddress("ketantest.test@gmail.com");
msg.To.Add("ketan_erp@yahoo.com");
msg.Subject = "test";
msg.Body = "body";
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
System.Net.NetworkCredential authorise = new
System.Net.NetworkCredential("ketantest.test@gmail.com", "ketantesttest");
SmtpClient spclient = new SmtpClient("smtp.gmail.com", 587);
spclient.EnableSsl = true;
spclient.UseDefaultCredentials = false;
spclient.Credentials = authorise;
spclient.Send(msg);

1 comment:

  1. Very good article. I have been enjoying this feature of "sending email using gmail (sounds like a song!)" for long time. Thanks.
    http://dotnetspidor.blogspot.com

    ReplyDelete