How to parse a .eml file in php?

maarten picture maarten · Jul 10, 2012 · Viewed 21.3k times · Source

How to parse a .eml file in php? Is there any PHP libriary or PHP extension ?

I want to display the mail header information such as sender, receiver, title, attachement and eml body content in browser.

Answer

Doa picture Doa · Jul 10, 2012

There are a couple of ways to do it. One way is to simply do it yourself, it's not that complicated.

Otherwise, you might want to have a look at the Mailparse library:

http://php.net/manual/en/book.mailparse.php

And there is also this one:

http://code.google.com/p/php-mime-mail-parser/