1add_action( 'phpmailer_init', 'setup_phpmailer_init' );
2function setup_phpmailer_init( $phpmailer ) {
3 $phpmailer->Host = 'HOSTNAME'; // for example, smtp.mailtrap.io
4 $phpmailer->Port = 587; // set the appropriate port: 465, 2525, etc.
5 $phpmailer->Username = 'YOURUSERNAME'; // your SMTP username
6 $phpmailer->Password = 'YOURPASSWORD'; // your SMTP password
7 $phpmailer->SMTPAuth = true;
8 $phpmailer->SMTPSecure = 'tls'; // preferable but optional
9 $phpmailer->IsSMTP();