Strip signatures and replies from emails

2019-01-29 21:57发布

I'm currently working on a system that allows users to reply to notification emails that are sent out (sigh).

I need to strip out the replies and signatures, so that I'm left with the actual content of the reply, without all the noise.

Does anyone have any suggestions about the best way to do this?

8条回答
爷、活的狠高调
2楼-- · 2019-01-29 22:45

There's a really nice PHP library dedicated to the email parsing

http://williamdurand.fr/EmailReplyParser/

https://github.com/willdurand/EmailReplyParser

查看更多
倾城 Initia
3楼-- · 2019-01-29 22:46

If you can assume that these emails are in plain text, just strip lines that begins with ">" as replies, and "-- " line should delimit signature. But those assumptions might not work, as not all people over internet use software that complies to rules.

查看更多
登录 后发表回答