我正在尝试使用Gmail SMTP服务器进行OAuth验证发送电子邮件。我已收到刷新令牌,一切都很顺利,但由于我找不到任何OAuth验证发送电子邮件的示例,所以似乎我在邮件发送脚本中漏掉了一些内容。 我的代码如下:
$phpmailer = new PHPMailerOAuth();
$phpmailer->IsSMTP();
$phpmailer->SMTPDebug = 2;
$phpmailer->Host = "ssl://smtp.gmail.com";
$phpmailer->SMTPAuth = true;
$phpmailer->SMTPSecure = 'ssl';
$mail->AuthType = 'XOAUTH2';
$phpmailer->Port = 465;
$phpmailer->oauthClientId = "***";
$phpmailer->oauthClientSecret = "***";
$phpmailer->oauthRefreshToken = "***";
$phpmailer->oauthUserEmail="***";