Removing e-mail quotes/replies in PHP

I have been recently dealing with Zend_Mail in order to open and display e-mails in my application.

The annoying thing, especially if you organize your discussion in a thread ( like Google), is to display all the old conversations (replies, quotes) on the page.

Every line usually starts with the “>” bracket symbol (“more than”) and it is easy to remove them using some simple REGEX rule in PHP:

echo preg_replace('/\s*(>.+\s*)/', "", $message);

It is basically looking for new lines with the bracket and then replacing them with nothing. If you have any comments, please don’t hesitate!

Jan26

Comments are closed.