Search code examples
phpemailimap

how to extract replied email from original email


I am using imap to grap emails and insert them into a mysql database. But I don't want the original email included.

So lets say I send out an email that contains this: Hello, How is the weather.

And then you respond The weather is great

The email that php reads from Imap looks like this: The weather is great Hello, How is the weather.

Is there away to remove the orginal message, "Hello, How is the weather."?

I am not to savvy on this stuff and will probably need things explained very clearly. Thanks!


Solution

  • Nope. Since there is no standard way to reply (i.e., some people use >, some use |, some top-post, some intermix, some attach) there's no way to accurately and reliably pull out the original. You could fiddle with regexp to catch some of the more common cases, but I think you'll find that route to be far more trouble than it's worth.