Email 设计忘记密码的电子邮件不发送

Email 设计忘记密码的电子邮件不发送,email,ruby-on-rails-4,devise,config,Email,Ruby On Rails 4,Devise,Config,我正试图发送一封忘记密码的电子邮件。但出现以下错误: Net::SMTPAuthenticationError in Devise::PasswordsController#create 535-5.7.8 Username and Password not accepted. Learn more at 我设法在日志文件中看到发送的电子邮件,但在实际收件箱中看不到。关于如何修复这个错误有什么想法吗 这是我的开发.rb代码- config.action_mailer.raise_deliv

我正试图发送一封忘记密码的电子邮件。但出现以下错误:

 Net::SMTPAuthenticationError in Devise::PasswordsController#create
 535-5.7.8 Username and Password not accepted. Learn more at
我设法在日志文件中看到发送的电子邮件,但在实际收件箱中看不到。关于如何修复这个错误有什么想法吗

这是我的开发.rb代码-

config.action_mailer.raise_delivery_errors = true

config.action_mailer.default_url_options = { :host => 'localhost:3000' }

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "gmail.com",
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: "myemail@gmail.com",
  password: "mypassword"
}
使用:rails 4和Desive 3.2.3


谢谢

当关联的电子邮件地址设置为双因素身份验证时,通常会发生此错误。如果您想使用相同的gmail帐户进行测试,则生成特定于应用程序的密码。请参阅详细信息


如果您有另一个不需要双因素身份验证的gmail帐户,请在代码中尝试该帐户。

它是双因素身份验证。非常感谢:)请特别通过用户Fareesh Vijayarangam检查此答案