我在 Gmail 上创建了一个帐户(因为前一个帐户也给我带来了同样的问题),以便我的应用程序可以使用 google smtp 服务器发送电子邮件。
我正在使用 PHPMailer 库并要求它显示任何日志错误。
我总是收到类似的消息。它略有不同,有时较短,有时较长,具体取决于我的配置
2015-08-01 05:07:01 CLIENT -> SERVER: EHLO www.lavile.com
2015-08-01 05:07:01 CLIENT -> SERVER: AUTH LOGIN
2015-08-01 05:07:01 CLIENT -> SERVER: Y29udGF0by5sYXZpbGVAZ21haWwuY29t
2015-08-01 05:07:01 CLIENT -> SERVER: WXlhdUgxMnM= 2015-08-01 05:07:01 SMTP ERROR: Password command failed: 534-5.7.9 Please log in with your web browser and then try again. Learn more at 534 5.7.9 https://support.google.com/mail/answer/78754 b16sm3352387qga.48 - gsmtp
2015-08-01 05:07:01 SMTP Error: Could not authenticate.
2015-08-01 05:07:01 CLIENT -> SERVER: QUIT
2015-08-01 05:07:01 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting string(82) "SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting"
这是我的脚本
$mail->Username = "[email protected]";
$mail->Password = "mypassword";
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->SetFrom($mail->Username, 'Contato Lavile');
$mail->addAddress($mail->Username, "Contato Lavile");
$mail->Subject = 'Novo contato no site Lavile';
$mail->Body = $text;
$mail->IsHTML(true);
$mail->AltBody = $text;
此外,GMAIL 还会自动向我自己发送电子邮件,提醒我新的登录尝试被阻止。我什至更改了 Gmail 上的一些设置以使其正常工作,但一切都失败了
有什么想法吗?你知道会发生什么吗?
我建议实际阅读错误消息:
... 534-5.7.9 请使用网络浏览器登录,然后重试。了解更多信息请访问 534 5.7.9https://support.google.com/mail/answer/78754b16sm3352387qga.48 - gsmtp
阅读此站点时,您会发现一些有关支持客户端的内容,这些内容仅提供不太安全的授权方法。您的客户就是其中之一,所以点击链接了解如何在 Gmail 中启用对这些应用程序的支持。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)