Skip to content

Instantly share code, notes, and snippets.

@markbiek
Last active January 17, 2017 16:02
Show Gist options
  • Select an option

  • Save markbiek/030d61d23eb869772e5b1a3fe47b7645 to your computer and use it in GitHub Desktop.

Select an option

Save markbiek/030d61d23eb869772e5b1a3fe47b7645 to your computer and use it in GitHub Desktop.
add_filter('wp_mail', 'handle_wp_mail');
function handle_wp_mail($args) {
if ($args['subject'] == 'Welcome to YOUR SITE') {
$newMessage = <<<EOT
<h2>Welcome to YOUR SITE</h2>
<p>Dear User,</p>
<p>Thanks for registering!</p>
EOT;
$newMail = [
'to' => $args['to'],
'subject' => $args['subject'],
'headers' => $args['headers'],
'attachments' => $args['attachments'],
'message' => $newMessage,
];
return $newMail;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment