rodrigobertin
9/18/2017 - 1:20 PM

PHP Mailer WP

PHP Mailer WP

<?php
/**
	* This function will connect wp_mail to your authenticated
	* SMTP server. This improves reliability of wp_mail, and
	* avoids many potential problems.
  	*/
	function send_smtp_email($phpmailer) {
		$phpmailer->isSMTP();
		$phpmailer->isHTML(true);
		$phpmailer->Host = "smtp.gmail.com";
		$phpmailer->SMTPAuth = true; // uncomment for gmail
		$phpmailer->Port = 587;
		$phpmailer->Username = "";
		$phpmailer->Password = "";
		$phpmailer->SMTPSecure = "tls"; // uncomment for gmail
    //$phpmailer->From = FROM;
    //$phpmailer->FromName = FROMNAME;
    //$phpmailer->SMTPDebug  = 2; // uncomment for full debug
	}
	
	add_action( 'phpmailer_init', 'send_smtp_email' );