When the plugin was first written, all BP emails were in plain text. So it made sense that we ran {{usermessage}} through strip_tags().
That was many years ago. Now, I'm guessing that the overwhelming majority of BP sites use BP's HTML emails. This means that we could begin allowing at least some HTML in emails.
A few considerations:
Emails are still sometimes sent as plain-text. The installation could be set up in such a way to force plain-text, or there could be a user preference to send plain-text emails only. In any case, we always send a plain-text version of the entire message in case the email client is configured not to parse HTML. So we still need the capacity to strip tags.
It's possible that tags in {{usermessage}} could be unbalanced, either due to excerpting or user error. We need to prevent against this.
We'll almost certainly want to impose pretty strict limits on the allowed tags. a, text formatting tags like em, list tags, img - probably not much more than that.
Another image is problem is that large images can break layout. We would likely want to intercept inline img tags and impose strict limits on the width parameter, to ensure that it works reasonably well across devices.
Related: #226, #220
When the plugin was first written, all BP emails were in plain text. So it made sense that we ran
{{usermessage}}
throughstrip_tags()
.That was many years ago. Now, I'm guessing that the overwhelming majority of BP sites use BP's HTML emails. This means that we could begin allowing at least some HTML in emails.
A few considerations:
{{usermessage}}
could be unbalanced, either due to excerpting or user error. We need to prevent against this.a
, text formatting tags likeem
, list tags,img
- probably not much more than that.src
is not publicly accessible (due to .htaccess,blog_public
, or some other restriction), the images won't render. Our best bet here may be to renderimg
tags by default, but to have robust filters in place to allow third-party developers to disable or modify the way thatimg
tags are included. See https://github.com/openlab-at-city-tech/openlab/blob/cfbba887d755abcb50e963743c81d50ddc2a36e2/wp-content/plugins/openlab-email-embedded-media/openlab-email-embedded-media.php for a specific implementation that demonstrates an approach.img
tags and impose strict limits on thewidth
parameter, to ensure that it works reasonably well across devices.