Created
August 21, 2015 14:31
-
-
Save strangerstudios/8521078ea92c1155a380 to your computer and use it in GitHub Desktop.
Clean up lost password/etc emails with wpmandrill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Clean up lost password/etc emails with wpmandrill | |
*/ | |
function my_wp_mail($email) | |
{ | |
//remove links like <http...> | |
$body = preg_replace("/\<http[^\>]*\>/", "", $email['html']); | |
// If there is no HTML, run through wpautop | |
if($body == strip_tags($body)) | |
{ | |
$email['html'] = preg_replace("/\<(http[^\>]*)\>/", "$1", $email['html']); | |
$email['html'] = make_clickable($email['html']); | |
$email['html'] = wpautop($email['html']); | |
} | |
return $email; | |
} | |
add_filter('wp_mail', 'my_wp_mail'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Fix Broken Password Reset Emails When Using wpMandrill" at Paid Memberships Pro here: https://www.paidmembershipspro.com/fix-broken-password-reset-emails-when-using-wpmandrill/