Skip to content

Instantly share code, notes, and snippets.

@infn8
Created February 25, 2015 18:36
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 infn8/b52d3cbf6587d018c376 to your computer and use it in GitHub Desktop.
Save infn8/b52d3cbf6587d018c376 to your computer and use it in GitHub Desktop.
Use Mandrill SMTP for WordPress wp_mail() function
<?php
/* Add this to your functions.php or plugin file */
add_action( 'phpmailer_init', 'configure_mandrill_smtp' );
function configure_mandrill_smtp( PHPMailer $phpmailer ){
$phpmailer->isSMTP(); //switch to smtp
$phpmailer->Host = 'smtp.mandrillapp.com';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 587;
$phpmailer->Username = 'MAILCHIMP_USER';
$phpmailer->Password = 'MAILCHIMP_API_KEY';
$phpmailer->SMTPSecure = 'tls';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment