Skip to content

Instantly share code, notes, and snippets.

@jonathanbardo
Last active August 29, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanbardo/3f6131d1d600113b418c to your computer and use it in GitHub Desktop.
Save jonathanbardo/3f6131d1d600113b418c to your computer and use it in GitHub Desktop.
Send email using WordPress
function smtp_mail( $phpmailer ) {
// Define that we are sending with SMTP
$phpmailer->isSMTP();
// The hostname of the mail server
$phpmailer->Host = YOURHOST;
// Use SMTP authentication (true|false)
$phpmailer->SMTPAuth = true;
// SMTP port number normally 25
$phpmailer->Port = '25';
// Username to use for SMTP authentication
$phpmailer->Username = USERNAME;
// Password to use for SMTP authentication
$phpmailer->Password = PASSWORD;
$phpmailer->From = FROM;
$phpmailer->FromName = FROMNAME;
}
add_action( 'phpmailer_init', 'smtp_mail', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment