You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of our emails has a multi-line HTML comment in it and I noticed it messes with EmailReplyParser.
Example PHP code:
<?php$parser = newEmailReplyParser\Parser\EmailParser();
$emailContent = "Start of test message, <!-- a multi-line HTML comment --> End of of test message.";
echo$parser->parse($emailContent)->getVisibleText();
Outputs:
Start of test message,
<!--
a multi-line HTML comment%
⚠️ Notice that it did not output "End of of test message."
The workaround is to remove the comments before giving the content to EmailReplyParser.
// Remove HTML comments from email content (because the EmailReplyParser doesn't like them)$emailContent = preg_replace('/<!--(.|\s)*?-->/', '', $text);
echo$parser->parse($emailContent)->getVisibleText();
Using EmailReplyParser v2.10.0 with PHP 7.4.
The text was updated successfully, but these errors were encountered:
tomfotherby
changed the title
Multi-line HTML comments mess with EmailParser
Multi-line HTML comments mess with EmailReplyParser
May 10, 2023
One of our emails has a multi-line HTML comment in it and I noticed it messes with EmailReplyParser.
Example PHP code:
Outputs:
The workaround is to remove the comments before giving the content to
EmailReplyParser
.Using EmailReplyParser v2.10.0 with PHP 7.4.
The text was updated successfully, but these errors were encountered: