Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically searching GMail?

Tags:

search

gmail

api

Is there any way to programmatically 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?

like image 226
Mun Avatar asked Jul 14 '10 00:07

Mun


1 Answers

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.

like image 173
In silico Avatar answered Nov 15 '22 20:11

In silico