电子邮件是否包含可以从 PHP 读取的外出标志
我正在对内部票务系统进行一些改进。系统从我们的交换服务器中提取电子邮件并将其转换为系统中的门票。在票证生成过程中,我们已经从每封电子邮件的标题中获取信息。
我想知道是否有一种方法可以确定电子邮件是否是外出回复并已自动发回。这可以来自任何系统,而不仅仅是 Outlook。这将非常有用,因为这些电子邮件可以被过滤掉并且不会转换为票证,从而减少我们系统中的垃圾邮件并节省我们的代理时间。
然而,这确实必须准确,因为我们宁愿手动处理这些电子邮件,也不愿错过非自动化的电子邮件。另一个有用的检测是从无效地址、服务器消息等反弹。
我正在使用 PHP 进行开发,但任何正确方向的指示将不胜感激。
I'm making some improvements to an internal ticketing system. The system pulls emails from our exchange server and converts them into tickets in the system. We already take information from the header of each email during this process of ticket generation.
What I would like to know is if there is a way to know for certain if an email is an out-of-office reply and has been automatically sent back. This would be from any system and not just Outlook. This would be useful as these emails could be filtered out and not converted into tickets, reducing spam in our system and saving our agents time.
However this really has to be spot on as we would rather handle these emails manually than miss an email that wasn't automated. Another helpful thing to detect would be bounce backs from invalid addresses, server messages and the like.
I am developing in PHP but any pointers in the right direction would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我总结了我在 stackoverflow 上找到的有关该主题的内容。
以下代码是检查 imap_fetchheader 或 imap_headerinfo 返回的主题和标头的函数。
如果每个电子邮件客户端都这样做就好了:-|通常他们应该发送一个空的返回路径,您的脚本可以识别该路径以过滤自动回复。但是,在我的测试中表明,我使用的 Outlook 版本不会发送此标头。
标识符字符串存储在数组中,以便更轻松地根据您的需求进行调整。
I summarized what I have found on stackoverflow about this topic.
Following code is a function that checks the subject and header returned by imap_fetchheader or imap_headerinfo.
If only every email client would do the same :-| Usually they should send an empty return-path, that can be identified by your script to filter an automatic reply. However, in my tests showed that this header were not send by the Outlook versions I have used.
The identifier strings are stored in an array to make it easier to adjust to your needs.
除了阅读电子邮件的实际文本并使用正则表达式查找模式之外,您可能还想查看电子邮件标头,看看是否有在这些情况下设置的任何特定标头。我很难理解当您的地址簿无法交换时您将如何处理退回邮件。
Aside from reading the actual text of the email and looking for patterns with regex, you might want to take a look at the email headers and see if there are any particular headers that are set in any of these circumstances. I'm having a hard time understanding how you would have to deal with bounce messages when your address book comes out of exchange.
RFC 3834 自动回复电子邮件的建议对此进行了讨论。它定义了
自动提交
标头字段,指示消息是否自动发送。检查它是否存在,如果存在,则排除该消息。This is discussed in RFC 3834 Recommendations for Automatic Responses to Electronic Mail. It defines the
Auto-Submitted
header field that indicates if the message was sent automatically. Check if it's there and if it is, then exclude that message.