Wednesday, March 16, 2011

Programmaticly use Gmail to receive e-mail?

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.

From stackoverflow
  • You can configure GMail to let you get at your mail with a POP3 client.

  • Use Gmail with IMAP.

    Matt Cruikshank : Sure - but with what libraries does Jonathan use IMAP?
    FlySwat : I think I'll use this one: http://www.codeplex.com/InterIMAP
    Martin Vobr : 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.aspx Shows 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
  • 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

  • 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.

    FlySwat : Link is broken, but cool idea.
  • 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.

0 comments:

Post a Comment