开发者

Reply to thread via email

开发者 https://www.devze.com 2023-02-16 05:27 出处:网络
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.

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. Th开发者_运维百科is 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.


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.


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.

0

精彩评论

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