ruby-on-rails - Rails SMTPAuthenticationError - 不接受用户名和密码
问题描述
我正在使用 Rails 6 并试图让动作邮件程序进行开发。一切正常,直到涉及 SMTP 身份验证。这是我的配置:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => "name@gmail.com",
:password => "gmail-password",
:authentication => :plain,
:enable_starttls_auto => true,
}
config.action_mailer.perform_caching = true
config.action_mailer.default_url_options = { :host => "localhost:3000" }
我确实允许谷歌允许不太安全的应用程序。它有什么问题。这是日志:
[ActiveJob] [ActionMailer::MailDeliveryJob] [3d533896-b670-404f-baa7-aaf9ecd8ff81] Error performing
ActionMailer::MailDeliveryJob (Job ID: 3d533896-b670-404f-baa7-aaf9ecd8ff81) from Async(mailers) in
9827.83ms: Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted. Learn more at
):
C:/Ruby26-x64/lib/ruby/2.6.0/net/smtp.rb:981:in `check_auth_response'
C:/Ruby26-x64/lib/ruby/2.6.0/net/smtp.rb:736:in `auth_plain'
C:/Ruby26-x64/lib/ruby/2.6.0/net/smtp.rb:728:in `authenticate'
C:/Ruby26-x64/lib/ruby/2.6.0/net/smtp.rb:565:in `do_start'
C:/Ruby26-x64/lib/ruby/2.6.0/net/smtp.rb:518:in `start'
它还需要什么工作?
解决方案
我有同样的错误。问题是Gmail password
不正确,因为 Google APP 不再可用。所以我不得不在我的 Gmail 帐户上重新创建应用程序并重新生成密码,就是这样!
推荐阅读
- kubernetes - 访问 Openshift 集群内不同安全组的私有 IP
- uwp - 如何启用通过超链接打开的 UWP 应用(深度链接)
- java - 我想用java写一个ffmpeg
- html - openhtmltopdf,基于html创建pdf/a但两页只有一页有内容
- google-sheets - 根据不同工作表中的条件对行求和的公式是什么?
- java - Android 从 AsyncTask 打开 JavaCameraView
- jquery - Ajax 请求复杂类型在 ApiController 参数中为空
- java - 从 Java 触发存储过程,它将 Compex 对象(如视图或表)作为输入/输出
- php - Laravel 5.7 中的懒惰收集
- python - MS Teams 机器人通知