Last active
August 23, 2016 06:33
-
-
Save JamieWritesCode/9a54590c97e378b9c1ba4c5d8a3255df to your computer and use it in GitHub Desktop.
Wordpress function to configure PHPMailer to use SMTP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'phpmailer_init', 'wph_phpmailer_init' ); | |
function wph_phpmailer_init( PHPMailer $phpmailer ) { | |
$phpmailer->IsSMTP(); | |
$phpmailer->setFrom('[email protected]', 'WEBSITE'); // default from address | |
$phpmailer->SMTPAuth = true; // enable SMTP authentication | |
$phpmailer->Port = 587; // set the SMTP server port | |
$phpmailer->Host = 'SMTP_HOST'; // SMTP server | |
$phpmailer->Username = 'SMTP_USERNAME'; // SMTP server username | |
$phpmailer->Password = 'SMTP_PASSWORD'; // SMTP server password | |
$phpmailer->SMTPSecure = 'tls'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment