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 em
The "API" to GMail is IMAP.
In IMAP the IDLE feature is used to tell the server to notify the client when there are changes to the mailbox.
IDLE is defined in RFC 2177 IDLE is an optional IMAP feature so this may or may not work on other IMAP servers.