7

I am writing an app to let users reply to a post or thread straight from their email similar to Facebook. Users can already add new posts via email and it is working fine.

When a new post is generated an email alert is sent to specific users and a unique reply address is created containing an encoded string with the original post/thread ID. This is working fine. The emails are sent and the system picks up the reply using the unique reply address.

My problem is trying to isolate the comment/reply in the email, from the quoted original email underneath. Here is an example of an email body received:

reply text

(Origional Email Header)On 10 March 2011 16:35, Example SIte 
<pwKVb1BVUITY4Ai-fKR8ioPrR8Zki9cKBmAA0njXi8Y@example.us= > wrote:

I have thought of using identifying characters or strings but each email provider displays the original email in a reply differently.

Does anyone have any ideas how I can isolate the reply text from the original email's header and body?

Thank you,

Chris.

Kit
  • 4,095
  • 7
  • 39
  • 62
  • Related? http://stackoverflow.com/questions/278788/parse-email-content-from-quoted-reply – Matt Mar 10 '11 at 17:30
  • @Matt - Thank you. I am looking over it now. Looks like there is no one straight answer (as expected :( ). – Kit Mar 10 '11 at 17:36

2 Answers2

1

For a support ticket system I wrote, I focused on using the References email header concatenating previous message ids onto that. Many systems will hold onto that, but, of course, not all. Plus, my system is organic, ie, attempts to process emails with any subject and body in less of a controlled environment. A work in progress.

Tom
  • 11
  • 1
0

Since different email servers are going to format headers differently in replies, I don't think there is any way to reliably catch all of them. But if you're dealing with a relatively small number of users, you can just use regex matching to catch some of the most common header formats and strip those.

J. Taylor
  • 4,567
  • 3
  • 35
  • 55
  • That is, unfortunately, I don't think there is a non-hack solution to this problem. I'm assuming it has to be response by email, right? That is, you can't just send them a reply link that points them to an online reply form? – J. Taylor Mar 10 '11 at 17:35