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

时间:2014-03-12 22:08:43

标签: 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

我设法在日志文件中看到已发送的电子邮件,但不在我的实际收件箱中。有关如何解决此错误的任何想法?

继承我的 development.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并设计3.2.3

由于

1 个答案:

答案 0 :(得分:2)

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

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

相关问题