same problems here: losing the newlines inside the mails generated by WordFence
Did you try the ‘Content’ checkbox in wpMandrill settings? I think it solves that issue.
And thanks for the suggestion! It will be added to v1.28. You’ll have to use the wpMandrill filter (mandrill_payload) though. By adding a new parameter (force_native) to true, it will fall back to the native wp_mail() function.
Stay tuned!
Thanks Will,
I didn’t notice the ‘Content’ checkbox. The problem however is that I do send both text and HTML email, so it might solve the plain-text email problem, but then introduce problem with my HTML emails…
Being able to control whether an email goes via mandrill or wp_mail would be very nice. I’m not sure I fully understand the proposed change via the filter, but as long as there’s a way to do it, I’d be happy. Currently I monkey-patch your plugin to do so, pun intended 😉
Cheers
Yoav
Often the sites I work with send out a combination of plaintext and HTML emails, depending on the plugins installed or any added functionality.
When I use wpMandrill’s ‘Content’ option, linebreaks are added to both plaintext and HTML emails. This works great for plaintext emails but not for HTML (it adds an extra <br>
after every line break, including closing tags).
Here’s a quick function I added to functions.php
that seems to have well so far on a variety of sites. Basically, just add a filter to mandrill_payload
that applies wpautop
to the content instead of using the ‘Content’ option in wpMandrill.
function op_mandrill_payload($message) {
// Add wpautop to message content
$message['template']['content'][0]['content'] = wpautop($message['template']['content'][0]['content']);
return $message;
}
add_filter('mandrill_payload', 'op_mandrill_payload');
This adds line breaks when needed, but not after closing tags. The result is an nearly all-inclusive solution for both plaintext and HTML emails.