@prometheus-fire I went digging in the codebase and figured out what is going on with this…
Certain plugins (the one I’m currently struggling with is Event Tickets) send a full HTML document for their HTML emails. However, this plugin (Email Templates) also creates a full HTML document and then just intercepts whatever is being sent through the wp_mail
function and wraps it in their template.
That’s all well and good, but you don’t want to send an email that has an HTML document wrapped in another HTML document inside it. So they run the email content through the wp_kses_post
function which strips certain html tags including <style>
tags. That is what is causing the styles to print in plain text.
It plays well with WooCommerce but doesn’t seem to play well with most other things that send out HTML emails that would have <style>
tags in them.
I did figure out a hacky solution where I’m grabbing the email content before they filter it (using their own mailtpl/email_content
hook). I’m grabbing the email content and storing it to a txt file on the server and then re-injecting it from that file after all of their filtering runs. I do some similar filtering to theirs, but leave the <style>
tags untouched. It’s hacky but it works.