可以用PHP读取邮件吗?
我不想使用 shell 脚本来读取服务器上的邮件。 我尝试使用 PHP 脚本来阅读该邮件。是否可以? 如果可以的话我该如何开始呢?
我对shell脚本有一点了解。
请给我开始的链接或代码。
I don't want to use shell script to read mail on the server.
I try to use PHP script to read that mail. Is it possible?
If it's possible, how can I start to do?
I know a little about shell script.
please give me the link or code to start with.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,你可以用 PHP 来完成。这取决于你需要哪种方式。此链接解释了如何在 PHP 中创建邮件客户端 http://www.devshed.com/c/a/PHP/Building-A-PHPBased-Mail-Client-part-1/
Yes you can do it in PHP. It depends on which way u need it. This link explains creation of mail client in PHP http://www.devshed.com/c/a/PHP/Building-A-PHPBased-Mail-Client-part-1/
我还写了
这篇文章展示了多种方法,包括轮询、收到消息时直接通过管道传输到您的应用程序、使用不需要您自己的邮件服务器的curl 和第三方解决方案。
I also wrote a blog post on this subject a while back. Sometimes using pop or imap might not be desirable, my blog was for Rails but the different options and principals still all apply.
The post shows a number of methods including polling, piping directly into your app when a message is received, using curl and third party solutions that don't require you're own mail server.
在某些时候,我想检查网站管理面板内的几个邮箱中是否有未读消息,因此我最终得到了一个简单的脚本,如此处所述的脚本。我们想要的是使用 PHP 的 IMAP 函数获取过去一周每个电子邮件帐户收件箱中的所有邮件。此外,我们将用不同的样式标记未读消息。
http://www.backslash .gr/content/blog/webdevelopment/8-check-your-email-with-php-and-imap
At some point I wanted to check if there was any unread messages in a couple mailboxes from inside an website administration panel, so I ended up with a simple script like the one described here. What we want is to fetch the all the messages in the INBOX of each e-mail account for the past week, using the IMAP functions of PHP. Also, we are going to mark the unread messages with a different style.
http://www.backslash.gr/content/blog/webdevelopment/8-check-your-email-with-php-and-imap