如何接收电子邮件并在 Web 应用程序中处理它 [英] How do I receive email and process it in a web application

查看:50
本文介绍了如何接收电子邮件并在 Web 应用程序中处理它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的 PHP Web 应用程序设置了电子邮件 ID.用户将向此 ID 发送电子邮件.

I have set up an email id my PHP web application. Users will send emails to this id.

我想在应用程序中处理这些电子邮件.我该怎么做?

I want to process these emails in the application. Ho do I go about doing this?

提前致谢.

推荐答案

我最近参与了一个项目,该项目需要解析来自 gmail 的电子邮件,并根据电子邮件的内容使用某些值更新数据库.我使用了 ezcMail (现在)Zeta Components 库,用于连接到邮件服务器并解析电子邮件.

I recently worked on a project that required parsing of email from gmail and updating database with certain values based on the contents of the email. I used the ezcMail (now) Zeta Components library to connect to the mail server and parse the emails.

我采用的策略是过滤所有带有未处理"标签的有趣传入邮件.每 15 分钟通过 crontab 运行一次 PHP 脚本.该脚本将连接到邮件服务器并打开 IMAP 未处理文件夹并解析每封电子邮件.将感兴趣的值插入数据库后,脚本将文件移动到另一个 IMAP 文件夹已​​处理".

The strategy I adopted was to filter all interesting incoming mail with a label "unprocessed". Run the PHP script via a crontab every 15 minutes. The script would connect to the mail server and open the IMAP unprocessed folder and parse each email. After inserting the interesting values into the database, the script moves the files to another IMAP folder "Proccessed".

我还发现 IMAP 比 POP 更好进行此类处理.

I also found IMAP to be better than POP for this sort of processing.

这篇关于如何接收电子邮件并在 Web 应用程序中处理它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆