开发者

monitoring an email address

开发者 https://www.devze.com 2022-12-08 04:02 出处:网络
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 po开发者_如何学Cll it?You could forward the mail to a *

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 po开发者_如何学Cll it?


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_to_pipe_an_email_to_a_PHP_script.html


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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号