Exforsys.com
 

Sponsored Links

 

Microsoft.NET Tutorials

 
Home Tech Articles Microsoft.NET
 

Email Sending from Gmail

 

Email Sending from Gmail

    This article will focus on following concept
  • Simplest way of sending email from Gmail

Simplest Way of Sending Email from Gmail

protected void btnSendEmail_Click(object sender, EventArgs e) { //Create Mail Message Object with content that you want to send with mail. System.Net.Mail.MailMessage MyMailMessage =
new System.Net.Mail.MailMessage("your_email_id","friends_email_id", "This is the mail subject", "Just wanted to say Hello"); MyMailMessage.IsBodyHtml = false; //Proper Authentication Details need to be passed when sending email from gmail System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential("your_email_id", "myPassword"); //Smtp Mail server of Gmail is "smpt.gmail.com" and it uses port no. 587 //For different server like yahoo this details changes and you can //get it from respective server. System.Net.Mail.SmtpClient mailClient =
new System.Net.Mail.SmtpClient("smtp.gmail.com",587); //Enable SSL mailClient.EnableSsl = true; mailClient.UseDefaultCredentials = false; mailClient.Credentials = mailAuthentication; mailClient.Send(MyMailMessage);

}

- CodeGuru-Dot-Net "Lets make programming easy"


Read Next: What are the features of .NET?



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2010 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape