知道电子邮件是否使用PHP中的IMAP进行回复 [英] Know if email was a reply using IMAP in PHP

查看:155
本文介绍了知道电子邮件是否使用PHP中的IMAP进行回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否在标题中,但是我正在寻找一种方法来判断我收到的电子邮件是对我发送的电子邮件的回复,如果是,只能抓住新的文本,不是引用的文本

I am not sure if it is in the headers or not, but I am looking for a way to tell if an email I receive is a response to an email I sent, and if so, to only grab the new text, not "quoted text"

一点背景:我正在创建一个脚本,将自动发送电子邮件。我正在创建一个cron工作,定期运行,以检查是否有任何回复。如果有回复,我只想抓住新的东西,而不是旧的东西。

A little background: I am creating a script that will send out emails automatically. I am creating a cron job to run at periodic intervals to check to see if there were any replies. If there were replies, I only want to grab the new stuff, and not the old stuff.

在过去,我会发送电子邮件与ID在主题(你有一个新的回复[1234]),然后检查主题的[和]之间的东西。然后,我会抓住所有的消息并存储它,因为每个Web浏览器/电子邮件使用不同的字符或风格的引用文本。有些做>一些做一个横向规则,有些做绝对没有。

In the past, I would send out emails with the id in the subject (You have a new response [1234]), and would then check the subject for the stuff in between the [ and ]. Then I would grab all the message and store it since every web browser/email uses a different character or style for quoted-text. Some do ">" some do a horizontal rule, some do absolutely nothing.

无论如何,我只是在电子邮件头中寻找一些表示他们正在回复的东西,新文本可能是什么如果不可能,我会继续做我正在做的事情。

Anyways, I am just looking for something in the email header that would indicate they are replying and what the new text might be. If it's not possible, I will just keep on doing what I am doing.

推荐答案

不幸的是,电子邮件客户端本质上可以做无论他们想要什么,您的消息,并没有可靠的标准来确定收到的消息如何发起在客户端。此外,IMAP与它没有任何关系。电子邮件可以通过多种不同的方式发送,包括网络邮件。

Unfortunately, e-mail clients can essentially do whatever they want with your message, and there is no reliable standard for determining how a received message originated at the client. In addition, IMAP doesn't really have anything to do with it. E-mails can be sent a number of different ways, including webmail.

您可以做的最好的就是在主题行中找到一个ID号码(假设改变它,他们很少做)。您也可以做Google做的...将答复文本模糊匹配发送到该地址的电子邮件。如果匹配,请考虑答复的一部分。尽管如此,这很费劲。

The best you can do is look for an ID number in the subject line (assuming folks don't change it, which they rarely do). You can also do what Google does... fuzzy match the reply text to e-mail you sent to that address. If it matches, consider it part of the reply. This takes great effort though.

这篇关于知道电子邮件是否使用PHP中的IMAP进行回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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