I am studying an application to trigger a PHP script based on new IMAP emails arriving on Gmail. What's the best way to know a new email has arrived on a Gmail IMAP account? I can't think of anything but to configure a cron job. I am running PHP + Nginx on a Linux (Ubuntu) box.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
I found out that that's just the way celular companies developers are doing to verify their clients gmail.
Well, start making the connection normaly, then:
And that's it.
By the way, here's some good informations about how IMAP works. My point is that: as IMAP makes possible to mantain virtually a kind of "Live Sync" connection, if you don't want to configure a MTA to receive email (like me), so IMAP is a real option for get "email pusshed" to you.
There's only two ways to get info from an email account, connect to it, reading it regularly (for example, by a cron-job) for new messages, or have the email forwarded to your own server, which pipes new email arriving into a PHP script.
Zend_Mail, part of the Zend Framework has Zend_Mail_Storage_Imap (which can be used without the rest of the MVC structure) which can connect to Gmail to poll an account.