monitoring an email address

Tag: gmail , libgmail Author: djrockbo_2006 Date: 2009-09-21

I'm hoping for an event based way to know when I get an email. Right now I'm using gmail but the email host isn't critical. Do I really have to poll it?

Best Answer

You could forward the mail to a *nix host that uses .forward files, then pipe the mail to a script that handles raising the event in your program (by pinging a URL, etc.)

Here's an example in a CPanel/PHP environment: http://kb.siteground.com/article/How%5Fto%5Fpipe%5Fan%5Femail%5Fto%5Fa%5FPHP%5Fscript.html

comments:

cool, google app engine can do this: it receive emails [email protected] and then ping my webhook with it. so users have to forward to their own myapp email address which is okay.

Other Answer1

If you connect to gmail using IMAP, you should be able to use the IDLE command. Gmail's IMAP server does support IDLE.

Other Answer2

RFC 5465 proposes a NOTIFY extension to IMAP. It is unlikely that many servers implement it, though.

Other Answer3

I've had bad luck with IDLE on both GMAIL and on Dreamhost (which uses courier). Exchange does a great job with IDLE though: I see mailbox updates in less than a second.

Without good IDLE support, yes, you need to poll.