RSS Feed   View my LinkedIn profile!   Twitter

Archives

May 2008 (2)
June 2008 (3)
April 2008 (1)
July 2008 (2)
August 2008 (4)
September 2008 (6)
October 2008 (5)
November 2008 (4)
December 2008 (4)
January 2009 (2)
February 2009 (4)
March 2009 (1)
April 2009 (8)
May 2009 (6)
June 2009 (4)
July 2009 (5)
August 2009 (3)
September 2009 (2)
October 2009 (7)
November 2009 (3)
December 2009 (3)
January 2010 (4)
February 2010 (1)

Other Blogs

David McWee's Blog

Links

SA SharePoint Users Group
SharePoint Team Blog
SharePoint Designer Team Blog
Ian Morrish's WSS Demo
Fabian William's Blog

Tag Cloud

Administration, Blogging, Branding, Business Data Catalog, Certification, Development, Maps, Office System, Other, SASUG, Search, Security, SharePoint 2010, SharePoint Conference, SharePoint Designer, SharePoint Events, Social Networking, vNext, Web 2.0, Wikis,

Certifications

Microsoft Certified Technology Specialist
Microsoft Certified Technology Specialist
  • Microsoft Office SharePoint Server 2007
    • Application Development
    • Configuration
  • Microsoft Windows SharePoint Services 3.0
    • Application Development
    • Configuration

.Net SMTPClient Send Through Gmail 

Tags:

To test a Mail application I’m working on, I decided to use GMail, but it wasn’t as easy as I’d hoped. Luckily, I found this code snippet on TechNet Forums that worked for me:

 

MailMessage msgMail = new MailMessage("?????@gmail.com", ??????@gmail.com, "subject", "message body");
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential("?????@gmail.com", "?????");
try
{
   smtp.Send(msgMail);
}
catch (Exception ex)
{
}

Just replace the question marks with your GMail credentials, and it should work for you too.

 
Posted by Tom Resing on 17-Oct-09
0 Comments  |  Trackback Url  |  Link to this post | Bookmark this post with:        
 

Comments

Name:
URL:
Email:
Comments: