I’m coding an email piping and I’m getting the message and everything but I’m struggling when it comes to extracting the new user reply and add it to the ticket log.
Some email clients add something like “On 2011-03-14, at 6:00 AM, SitePoint wrote:” before older messages other don’t… I’m completely lost.
I would suggest you use mailparse extension. You can install it from pecl.php.net
It may not be the easiest extension to use, but once you figure it out, it’s the best way to extract parts from email. The reason it’s not so easy is because there are so many different email formats, email is not just headers and body, it can be in multipart format, have attachments, embedded attachments, etc.
mailparse can handle them all but it does not do it all automatically, you need to learn how to use it. There are some examples included in the source code to get you started
The only way you are going to tell what parts of what is returned are old messages is if you compare the parts of the message to the old messages already stored.