views:

980

answers:

5

I'd like to use a C# program to poll a gmail account and automatically download new messages. I know you can use gmail as an outbound SMTP server, but is there any way to access new messages sent to the account?

EDIT: Thanks for the rapid feedback....so I have two options, POP or IMAP.

Which one should I use? And why?

EDIT #2: Looks like IMAP allows me to not have to poll. Looks like the way to go.

+8  A: 

Use Gmail with IMAP.

Nathan
Sure - but with what libraries does Jonathan use IMAP?
Matt Cruikshank
I think I'll use this one: http://www.codeplex.com/InterIMAP
FlySwat
What about this one?Shows how to get list of unread messages (IMAP, VB.NET)http://blog.rebex.net/news/archive/2007/05/28/howto-get-list-of-unread-messages-from-an-imap-server-in-vb-net.aspxShows how to get message list from POP3 server (C#)http://blog.rebex.net/news/archive/2007/05/14/howto-download-emails-from-gmail-account-in-csharp.aspx
Martin Vobr
A: 

By the way, there is an instruction how to use SMTP with SSL with GMail: http://www.mono-project.com/FAQ:_Security#Does_SSL_works_for_SMTP.2C_like_GMail_.3F

abatishchev
+1  A: 

You can get an Atom Feed of your GMAIL, which can be fetched with a regular web request, and parse as a regular XML document. I made a PHP page I could access from my phone (which doesn't support Atom Feeds, or pages as advanced as Google Mobile), to show me a list of new emails.

Kibbee
Link is broken, but cool idea.
FlySwat
A: 

There is a C# component on SourceForge that lets you do exactly that. At some point I wrote an NT Service that runs in the background and downloads files from a gmail account.