PHP MIME Email Message Parser: Decode MIME e-mail messages

Recommend this page to a friend!
  Info   Example   Screenshots   View files (22)   Download .zip   Reputation   Support forum (217)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-04-22 (3 months ago) 79%Total: 30,101 This week: 6All time: 16 This week: 35
Version License PHP version Categories
mimeparser 1.84BSD License4.3Email, Text processing, Parsers
Description Author

This class can be used to parse and decode MIME e-mail messages.

It supports decoding single RFC 2822 MIME messages or archives that aggregate multiple messages in the mbox format.

The decoded message data is returned as an array that describes one or more messages found in a message file or data string.

The bodies of multipart messages can be decoded into distinct sub-messages.

The message body data can decoded and saved to separate files, so the class can handle messages larger than the available memory.

The parser can tolerate some syntax errors in malformed messages that are not compliant with RFC 2822.

An auxiliar class is provided to parse and extract e-mail address lists from message headers.

Recommendations

Recommendation for a PHP class to save email attachment
Read email and save attachment

What is the best PHP display email with images class?
IMAP function to find an inline email images

saving email attachment into local folder
I want to save all attachment from all email into local folder

What is the best PHP imap email body decode class?
Need to encode =0D=0A=0D=0A such text to tab or new line

Retrieve email from gmail with imap
Retrieve mail and decode correctly

How to extract HTML from message file?
Read HTML from message in Outlook

SMS Messages to Email
Get SMS Messages

What is the best PHP mail mime decode class?
Parse email messages

Picture of Manuel Lemos
  Performance   Level  
Name: Manuel Lemos is available for providing paid consulting. Contact Manuel Lemos .
Classes: 41 packages by
Country: Portugal Portugal
Age: 51
All time rank: 1
Week rank: 3 1 in Portugal Portugal

Screenshots  
  • mimeparser.gif
  Files  
File Role Description
test (1 file, 3 directories)
test_message_decoder.php Example Example script to demonstrate how to decode a e-mail message
test_parse_addresses.php Example Example to demonstrate how to parse e-mail address lists
mime_parser.php Class MIME message parser and decoder class
mime_parser_class.html Doc. Class documentation
rfc822_addresses.php Class Class to parse e-mail address lists from message headers
rfc822_addresses_class.html Doc. Documentation of the RFC 822 address parser class

  Files  /  test  
File Role Description
expect (7 files)
sample (7 files)
generated (1 file)
   test.php Test Unit test script to verify different message parsing cases

  Files  /  test  /  expect  
File Role Description
   longheader.txt Doc. Long header test expected results
   mbox.txt Data Expected output of the mbox test
   missingheaderseparator.txt Data Expected output of the missingheaderseparator test
   mixedlinebreaks.txt Data Mixed line breaks test expected results
   normal.txt Data Expected output of the decoder example script when parsing the message.eml file
   parse_addresses.txt Data Expected output of the e-mail address parser example script
   q-encoding.txt Data Q-encoding test expected results

  Files  /  test  /  sample  
File Role Description
   longheader.eml Data Long header test sample message
   mbox.eml Data Sample mbox message file
   message.eml Data Sample MIME message file used by the example script
   missingheaderseparator.eml Data Sample MIME message file used by the example script
   mixedlinebreaks.eml Data Mixed line breaks test sample message
   noendbreak.eml Data Sample MIME message file used by the example script
   q-encoding.eml Data Q-encoding test sample message

  Files  /  test  /  generated  
File Role Description
   .cvsignore Data Dummy file to force the distribution of this directory

 Version Control Reuses Unique User Downloads Download Rankings  
 86%2
Total:30,101
This week:6
All time:16
This week:35
User Ratings User Comments (11)
 All time
Utility:94%
Consistency:91%
Documentation:77%
Examples:78%
Tests:77%
Videos:-
Overall:79%
Rank:31
 
This was the MIME Email Message Parser I needed.
3 years ago (Susan Bassein)
90%
Thank you!
4 years ago (Michael)
80%
Awesome! Non verbose, easy to understand without reading any ...
4 years ago (Nadir)
85%
Great little class, extremely useful and it made my work very...
4 years ago (Chris King)
67%
out of several classes, this is the only one that works for m...
5 years ago (scott backup)
90%
worked well for us in 2 usages
9 years ago (Tushar)
80%
Perfect class.
10 years ago (ilinsky)
90%
Not a simple class.
11 years ago (Thales Jacobi)
60%
Perfect.
11 years ago (Daniel Tlach)
90%
Only use for decode body and attachment, but working very weel !
12 years ago (seb)
87%
This was exactly what I needed.
12 years ago (Ilan Berkner)
82%
 

For more information send a message to info at phpclasses dot org.