tags:

views:

59

answers:

3

Is there any way to programatically search GMail, preferably using C#?

For example, I'd like to get all email messages matching the search label:MyLabel from:[email protected], so that I can parse the email bodies as required.

The only thing remotely feasible I've found is the GMail API by Johnvey Hwang, though it doesn't look like it supports searching email and also hasn't been updated in many years either.

In any case, I haven't had much luck in getting it to even connect to my account so far, and was wondering if this even works anymore?

+1  A: 

Create an IMAP client, or use a library, to access Gmail and search for e-mail messages. The IMAP protocol explicitly supports searching on the server-side. Make sure IMAP access is enabled for the Gmail account.

Note that in Gmail, labels are treated like IMAP folders.

In silico
A: 

There must be a way of doing it, because Google Desktop Search finds items in your Gmail account.

Whether there's an officially publicly released API is quite another matter, of course.

A: 

Eventually, I settled with using IMAPX, which works pretty well. Tried a few other IMAP libraries which weren't as powerful and seemed a bit flaky.

If anyone's interested, the outcome of this is iDevice App Reporter, which is a WinForms app that searches GMail (or any other IMAP mailbox) for iTunes app receipts and parses these to return a list of downloaded/purchased apps from the Apple AppStore.

Mun