Skip to content

Instantly share code, notes, and snippets.

@svrooij
Created May 1, 2015 18:31
Show Gist options
  • Save svrooij/db3ac2c847bc574f63bc to your computer and use it in GitHub Desktop.
Save svrooij/db3ac2c847bc574f63bc to your computer and use it in GitHub Desktop.
Wordpress email with Gmail
// add the following to your themes functions.php file
// Off course, you should never change the parent theme and put all the changes in a child theme
add_action( 'phpmailer_init', 'gmail_phpmailer_init' );
function gmail_phpmailer_init( PHPMailer $phpmailer ) {
$phpmailer->Host = 'smtp.gmail.com';
$phpmailer->Port = 587;
$phpmailer->Username = '[email protected]'; // Full username (with @gmail.com)
$phpmailer->Password = 'your_secret_password'; // Your own password
$phpmailer->SMTPAuth = true; // Gmail requires authentication
$phpmailer->SMTPSecure = 'tls'; //587 is the tls port, ssl can also be configured with 'ssl' and port is another possible value
$phpmailer->IsSMTP();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment