tags:

views:

60

answers:

4

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?

+3  A: 

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

Peter
+2  A: 

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

Martin v. Löwis
+1  A: 

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.

vy32
+3  A: 

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

Matt Miller
cool, google app engine can do this: it receive emails *@myapp.appspotmail.com and then ping my webhook with it. so users have to forward to their own myapp email address which is okay.
Dustin Getz