Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fatal error: Uncaught Error: Call to undefined function PhpMimeMailParsermailparse_msg_parse_file() in /home/mysite/public_html/vendor/php-mime-mail-parser/php-mime-mail-parser/src/Parser.php:106 Stack trace: #0 /home/mysite/public_html/email-to-database.php(13): PhpMimeMailParserParser->setPath('path/to/mail.tx...') #1 {main} thrown in /home/mysite/public_html/vendor/php-mime-mail-parser/php-mime-mail-parser/src/Parser.php on line 106
- require_once('vendor/autoload.php');
- $path = 'path/to/mail.txt';
- $Parser = new PhpMimeMailParserParser();
- // 1. Specify a file path to the mime mail.
- $Parser->setPath($path);
- // Once we've indicated where to find the mail, we can parse out the data
- $to = $Parser->getHeader('to'); // "test" <test@example.com>, "test2" <test2@example.com>
- $addressesTo = $Parser->getAddresses('to'); //Return an array : [[test, test@example.com, false],[test2, test2@example.com, false]]
- $from = $Parser->getHeader('from'); // "test" <test@example.com>
- $addressesFrom = $Parser->getAddresses('from'); //Return an array : test, test@example.com, false
- $subject = $Parser->getHeader('subject');
- $text = $Parser->getMessageBody('text');
- $html = $Parser->getMessageBody('html');
- $htmlEmbedded = $Parser->getMessageBody('htmlEmbedded'); //HTML Body included data
- $stringHeaders = $Parser->getHeadersRaw(); // Get all headers as a string, no charset conversion
- $arrayHeaders = $Parser->getHeaders(); // Get all headers as an array, with charset conversion
- // Pass in a writeable path to save attachments
- $attach_dir = '/path/to/save/attachments/'; // Be sure to include the trailing slash
- $include_inline = true; // Optional argument to include inline attachments (default: true)
- $Parser->saveAttachments($attach_dir,[$include_inline]);
- // Get an array of Attachment items from $Parser
- $attachments = $Parser->getAttachments([$include_inline]);
- /*
Add Comment
Please, Sign In to add comment