-
Notifications
You must be signed in to change notification settings - Fork 81
PHP Raw Email Parser
License
daniele-occhipinti/php-email-parser
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Project Status -------- This project is no longer maintained. It might still be used (at your own risk) for small projects, especially where you know the exact format of the emails you are going to parse. However, this piece of software is surely not equipped for parsing the wide variety of email formats out there. There are a number of known issues which can be found in the [Issues section](https://github.com/daniele-occhipinti/php-email-parser/issues) on this page. There are a number of suggested code changes in the [Pull requests sections](https://github.com/daniele-occhipinti/php-email-parser/pulls) on this page. For better alternatives, [this Stackoverflow page may be of help](https://stackoverflow.com/questions/4721410/best-way-to-handle-email-parsing-decoding-in-php). Documentation -------- N.B.: if you deal with non-English languages, we recommend you install the IMAP PHP extension: the Plancake PHP Email Parser will detect it and used it automatically for better results. This library allows you to easily parse an email given its content (headers + body). Usage example: $emailPath = "/var/mail/spool/dan/new/12323344323234234234"; $emailParser = new PlancakeEmailParser(file_get_contents($emailPath)); // You can use some predefined methods to retrieve headers... $emailTo = $emailParser->getTo(); $emailSubject = $emailParser->getSubject(); $emailCc = $emailParser->getCc(); // ... or you can use the 'general purpose' method getHeader() $emailDeliveredToHeader = $emailParser->getHeader('Delivered-To'); $emailBody = $emailParser->getPlainBody();