WordPress邮件代码

functions.php添加


add_action('phpmailer_init', 'mail_smtp');
function mail_smtp( $phpmailer ) {
$phpmailer->FromName = 'xxx'; // 发件人昵称
$phpmailer->Host = 'smtp.qq.com'; // 邮箱SMTP服务器
$phpmailer->Port = 465; // SMTP端口,不需要改
$phpmailer->Username = 'xxx@qq.com'; // 邮箱账户
$phpmailer->Password = 'xxx'; // 此处填写邮箱生成的授权码,不是邮箱登录密码
$phpmailer->From = 'xxx@qq.com'; // 邮箱账户同上
$phpmailer->SMTPAuth = true;
$phpmailer->SMTPSecure = 'ssl'; // 端口25时留空,465时ssl,不需要改
$phpmailer->IsSMTP();
}
Archived: Job