开发者

how to extract replied email from original email

I am using imap to grap emails and insert them into a mysql database. But I don't want the original email included.

So lets say I send out an email that contains this: Hello, How is the weather.

And then you respond The weather 开发者_如何学Gois great

The email that php reads from Imap looks like this: The weather is great Hello, How is the weather.

Is there away to remove the orginal message, "Hello, How is the weather."?

I am not to savvy on this stuff and will probably need things explained very clearly. Thanks!


Nope. Since there is no standard way to reply (i.e., some people use >, some use |, some top-post, some intermix, some attach) there's no way to accurately and reliably pull out the original. You could fiddle with regexp to catch some of the more common cases, but I think you'll find that route to be far more trouble than it's worth.


To my knowledge, there is no foolproof way to do this. When you reply to an email, the MUA has the right to reformat the original message as it sees fit. For example, Outlook may convert the original text to HTML and add invisible tags.

If you have access to the whole email thread, you may be able to find the original message based on subject or any hints that the headers give you.

This is all AFAIK, so someone please correct me if I am wrong.


You could do what Gmail does when you are sending multiple emails back and forth with the same subject.

Just keep a copy of the email that you send and then when you get a reply, look for similar text or as Gmail refers to it: "quoted text".

Or you can look for certain patterns based on their email domain. However, there is no answer that will work 100% of the time; it is all just based on your best guess.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜