Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created August 21, 2015 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/8521078ea92c1155a380 to your computer and use it in GitHub Desktop.
Save strangerstudios/8521078ea92c1155a380 to your computer and use it in GitHub Desktop.
Clean up lost password/etc emails with wpmandrill
/*
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');
@laurenhagan0306
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment