php-mime-mail-parser: Mail Parsing Incorrectly

Hey Guys,

I first off want to say great job on the class thus far. Quite easy to work with… I do have 1 issue which is a bit of a major issue for me…

So my Outlook 2019 is set to use HTML formatted emails. But when I get the message body, I have to get the text format, the html does not give me any content, just returns blank. That then means when I work with the email and save it, I lose everything from bold text, to UL’s or OL’s

What might cause this? Do I need to change something on my side to have the email parsed correctly?

Code Snippet:

$parser->setStream(fopen("php://stdin", "r"));

$arrayHeaderTo = $parser->getAddresses('to');

$rawHeaderFrom = $parser->getHeader('from');
$arrayHeaderFrom = $parser->getAddresses('from');

$subject = $parser->getHeader('subject');

$text = $parser->getMessageBody('text');
$html = $parser->getMessageBody('html');

In the aboe example $html is empty and $text has the email’s body, but unformatted.

Kind Regards

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

The HTML in your comment is not in the email. It’s an HTML that Outlook is able to produce by parsing the winmail.dat that is a file that only Microsoft can understand.