Monday, April 09, 2007

Using Google/GMail as your .Net SMTP Server

My C# Corner - How to utilize Google gmail server in your.NET Web & Windows Applications

"Did you know you can use your gmail mail server to send and receive emails programmatically for free?

It's true; gmail allows you to use their mail servers to send email from your applications. If you combine that with the ASP.NET System.Net.Mail.SmtpClient class, you are ready to use your free gmail account and server. 

..."

In hindsight of course you can do this... If Outlook can be configured to send emails through GMail's SMTP's servers, then so can a .Net app.

I guess sometimes I need to get smacked over the head to help focus my hindsight.   ;)

And best of all (IMHO) their SMTP server (smtp.gmail.com) runs on a non-SMTP standard Port (587), and thereby may not be blocked by outbound filters (okay, yeah I know, that's a good thing/bad thing...).

In any case, this is a good bit of info I should be able to use...

(via DotNetKicks - Programmatically send emails using Google mail server and System.Net.M)

Update 4/9/2007 @ 9:42AM PDT:

Sigh... I REALLY should search my own blog before posting...

I blogged about this already last May, "Send E-Mail from your .NET application using your GMail Account"

Dogh!

5 comments:

Marcos Meli said...

Thats very fun dude !!!

You fighting with your brain in a post :P

Cheers

gamedaygeorge said...

Have you heard of a way to do this through Google, but with a non-gmail email address?

Greg said...

No, I sure haven't...

Anonymous said...

Greg, That is very cool! Now, I have a question and cant find the answer anywhere. I've searched for several days now...

Can we reverse this? For compliance reasons, I need to store email to and emails from - everyone I communicate with.

Do you know if we can we store google mail's content (to, from, subject, etc, etc...) into SQL Server? I have been searching the gmail groups and the sql server groups.

Thanks for any direction you can provide!

Anthony

Greg said...

I'd likely use the GMail POP3 support to pull the emails...

For example you can use Outlook to download all the Gmail emails into a local PST using POP3 (that's what I do) for archiving or compliance.

To get it into SQL Server, you're going to have to write some code. You can use a POP3 library to automate the downloading of emails as well (I'm sure just about every programming language has a POP3 library or component that can be purchased or found free to download)

How do I enable POP?
Configuring other mail clients
Configuring your email client: Outlook 2003

I hope this helps a little,
Greg