Skip to content

Instantly share code, notes, and snippets.

@mustafauysal
Last active December 17, 2015 04:58
Show Gist options
  • Select an option

  • Save mustafauysal/5553961 to your computer and use it in GitHub Desktop.

Select an option

Save mustafauysal/5553961 to your computer and use it in GitHub Desktop.
Send WordPress system mails via SMTP.
<?php
function wp_smtp($phpmailer){
$phpmailer->Mailer = "smtp";
$phpmailer->From = "System";
$phpmailer->FromName = "System Name";
$phpmailer->Sender = "no_reply@example.com";
$phpmailer->AddReplyTo($phpmailer->From,$phpmailer->FromName);
$phpmailer->Host = 'smtp.gmail.com';
$phpmailer->SMTPSecure = 'tls';
$phpmailer->Port = 587;
$phpmailer->SMTPAuth = TRUE;
if($phpmailer->SMTPAuth){
$phpmailer->Username = "mailaddress@gmail.com";
$phpmailer->Password = "passwordhere";
}
}
add_action('phpmailer_init','wp_smtp');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment