gpt4 book ai didi

email - 使用 Gmail : Failed to authenticate on SMTP server 发送邮件的脚本

转载 作者:行者123 更新时间:2023-12-04 02:39:41 24 4
gpt4 key购买 nike

我很难让我的 PHP 脚本使用 SMTP Gmail 帐户发送电子邮件。我正在使用 PHP 和 Symfony2 SwiftMailer,但问题似乎出在我的 Gmail 帐户配置上。在我的日志中,我最终得到以下错误消息:

"ERROR - Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "new.user.name@gmail.com" using 1 possible authenticators"

幸运的是,我有另一个 Gmail 帐户,可以无缝地使用另一个应用程序。在我的新盒子上拯救这些参数(用户和密码),一切都很好。

在 parameters.yml 我有(工作正常):
parameters:
mailer_transport: gmail
mailer_host: ~
mailer_user: old.user.account@gmail.com
mailer_password: old-password

这是给出身份验证错误消息的版本:
parameters:
mailer_transport: gmail
mailer_host: ~
mailer_user: new.user.account@gmail.com
mailer_password: new-password

不用说,我已经检查、重新检查并再次检查用户和密码。

我在新帐户的“转发和 POP/IMAP”下查看了我的 Gmail 帐户设置:我找不到有关 SMTP 的任何信息。

搜索使我意识到某些验证码策略可能会干扰 SMTP 帐户。我读了 here我应该尝试输入验证码短语,我这样做 here ,并收到一条好消息:“帐户访问权限已启用”、“请尝试从您的新设备或应用程序再次登录您的 Google 帐户。”

再试一次。没运气。

所有这一切都发生在我的本地开发环境中(OK 邮件和 NOT OK 邮件)。

如何通过新创建的 Gmail 帐户使用 SMTP?任何的想法 ?

最佳答案

实际上,仔细检查我的收件箱,我看到我收到了一封来自 Google 的邮件,说明有人试图输入我的帐户。在那里,我找到了我正在寻找的配置参数的链接:

https://www.google.com/settings/security/lesssecureapps

==> 我只需要检查:“让我的帐户不那么安全。”,并且能够发送邮件。

与此同时,我发现 Gmail SMTP 服务变得非常不可靠,并时不时地引入验证码 (here) .我似乎对此无能为力。另一方面,我读到更强的密码似乎在某些情况下有帮助 (here) .

我还必须说,使用新创建的帐户,我无法使其正常工作。甚至取消选中“使我的帐户过于安全”选项。看起来 Gmail 正在逐步淘汰其 SMTP 服务。

更新

我想提一下,有一些优秀且免费(或非常、非常便宜)的电子邮件发送替代方案。例如,您可以查看 Mandrill , SendGridAmazon SES ,等等。

关于email - 使用 Gmail : Failed to authenticate on SMTP server 发送邮件的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29098781/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com