I\'m writing some code to parse forwarded emails. What I\'m not sure is if maybe there is some Python library, some RFC I could stick to or some other resou
In my experience just about ever email client forwards/replies differently. Typically you'll have a plain text version and a html encoded version in the mime at the bottom of the mail pack. Mail headers do have a RFC (http://www.faqs.org/rfcs/rfc2822.html "2822"), but unfortunately the content of the message body is out side the scope.
Not only do you have to contend with the mail client variance, but the variance of user preferences. As an example: Lotus Notes puts replies at the top and Thunderbird replies at the bottom. So when a Thunderbird user is replying to a Lotus Notes user's reply they might insert their reply at the top and leave their signature at the bottom.
Another pitfall maybe contending with word wrapping of replied chains.
>>>> The outer reply that goes over the limit and is word wraped by
the middle replier's mail client\n
>> The message body of a middle reply
> Previous reply
Newest reply
I wouldn't parse the message and leave it to the user to parse in their heads. Or, I'd borrow the code from another project.