0

I want to develop an application that would extract the following things from an email id,

  • A notification about a new email
  • Subject
  • Sender
  • Total Unread emails

Now as I think it wont be easy to extract emails from all of the major email providers so I basically want to do it for Gmail.

I just need to find the way to do it. Please guide me. Thanks

2
  • You can connect to GMail using IMAP and do everything you need. Check out php.net/manual/en/book.imap.php Commented Mar 30, 2012 at 13:30
  • what is code monkey question again? Commented Mar 30, 2012 at 13:39

2 Answers 2

3

It's actually fairly easy using the PHP IMAP extension. There are lots of functions there that you can use to list all emails in an inbox, get a count of them. Read their subjects or contents and such.

In GMail labels are the equivalent of folders in the IMAP docs.

You can connect to a GMail like this:

$mailbox = imap_open('{imap.gmail.com:993/imap/ssl}', '[email protected]', $password); 

Oh! Also you need to log in to GMail on the account you won't to allow email access to, go to Mail Settings -> Forwarding and POP/IMAP-> Enable IMAP

Sign up to request clarification or add additional context in comments.

Comments

3

Documentation for the GMail API: https://developers.google.com/google-apps/gmail/

There will probably be some code monkeying involved in fetching the correct data, so I would recommend you to hire a nearby consultant doing it for you.

Comments