通过 PHP 检查 Gmail IMAP 循环中的新邮件
我正在研究一个应用程序,用于根据到达 Gmail 的新 IMAP 电子邮件触发 PHP 脚本。了解 Gmail IMAP 帐户已收到新电子邮件的最佳方式是什么?除了配置 cron 作业之外我想不出什么。我在 Linux (Ubuntu) 机器上运行 PHP + Nginx。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现这正是蜂窝公司开发人员验证客户 Gmail 的方式。
好吧,开始正常连接,然后:
就是这样。
顺便说一下,这里有一些关于 IMAP 如何工作的好信息。我的观点是:由于 IMAP 几乎可以维持一种“实时同步”连接,如果您不想配置 MTA 来接收电子邮件(像我一样),那么 IMAP 是获取“电子邮件推送”的真正选择”给你。
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.
只有两种方法可以从电子邮件帐户获取信息,连接到该帐户,定期阅读(例如,通过 cron 作业)以获取新消息,或者将电子邮件转发到您自己的服务器,该服务器将到达的新电子邮件传送到PHP 脚本。
Zend_Mail,Zend Framework 的一部分有 Zend_Mail_Storage_Imap (可以在没有MVC 结构的其余部分)可以连接到 Gmail 来轮询帐户。
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.