Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to receive push notifications from my Gmail account?

I'd like to write an application which monitors a mailbox (ideally a Gmail mailbox). In brief, my question is how do I listen to incoming emails? I could always keep pulling emails but I am afraid that this doesn't scale very well.

How does iOS do it with Gmail? I think they are using Exchange protocol, but I am not sure. Does anybody have an idea on how to do it? Is there a solution which already does something similar? I just need a hook.

Thanks!

like image 704
Martin Avatar asked Jan 27 '12 21:01

Martin


1 Answers

The most universal "API" for monitoring a Gmail or Google Apps inbox is the IMAP protocol. There's some information about this here: Gmail IMAP OAuth for desktop clients

For Google Apps inboxes (not general consumer Gmail accounts), you can also use the Gmail Inbox Feed, which provides an AtomPub XML feed of unread messages in a Google Apps inbox: http://code.google.com/apis/gmail/docs/inbox_feed.html

like image 166
Michael Manoochehri Avatar answered Oct 13 '22 21:10

Michael Manoochehri