Skip to content

Instantly share code, notes, and snippets.

@ljanecek
Created March 21, 2018 18:35
Show Gist options
  • Save ljanecek/812b7f5c96c4aa77ffa81a609056d7fa to your computer and use it in GitHub Desktop.
Save ljanecek/812b7f5c96c4aa77ffa81a609056d7fa to your computer and use it in GitHub Desktop.
Mandrill, WP, wp_mail, How to Send Mandrill Email via wp_mail
add_action('phpmailer_init', function( PHPMailer $phpmailer ){
$phpmailer->isSMTP();
$phpmailer->Host = 'smtp.mandrillapp.com';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 587;
$phpmailer->Username = 'USERNAME';
$phpmailer->Password = 'APIKEY';
$phpmailer->SMTPSecure = 'tls';
$phpmailer->addCustomHeader('X-MC-Subaccount', 'SUBACCOUNT');
$phpmailer->setFrom('default@email.com', 'Default Title');
$phpmailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment