📅  最后修改于: 2022-03-11 14:54:36.078000             🧑  作者: Mango
add_action( 'phpmailer_init', 'setup_phpmailer_init' );
function setup_phpmailer_init( $phpmailer ) {
$phpmailer->Host = 'HOSTNAME'; // for example, smtp.mailtrap.io
$phpmailer->Port = 587; // set the appropriate port: 465, 2525, etc.
$phpmailer->Username = 'YOURUSERNAME'; // your SMTP username
$phpmailer->Password = 'YOURPASSWORD'; // your SMTP password
$phpmailer->SMTPAuth = true;
$phpmailer->SMTPSecure = 'tls'; // preferable but optional
$phpmailer->IsSMTP();