The code that trims paragraph tags breaks formatted body if there is more than one paragraph
This code removes wrapping <p>
and </p>
from outgoing HTML messages. It only checking of the tags are present, not if there’s more than a pair. That means that if there’s more than one paragraph, we get broken HTML as a result.