【问题标题】:Net::SMTPAuthenticationError in Devise::PasswordsController#create when working with devise mailers使用设计邮件程序时设计中的 Net::SMTPAuthenticationError::PasswordsController#create
【发布时间】:2015-04-09 15:44:50
【问题描述】:

我正在为我的应用程序实施设计邮件,我已完成以下步骤:

在模型中:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable
end

然后我添加了 confirmation_token、confirmed_at、 Confirmation_sent_at

在 devise.rb 中,我添加了:

  config.mailer_sender = 'example@gmail.com'
  #config.mailer = 'Devise::Mailer'

在 development.rb 中:

config.assets.raise_runtime_errors = true
config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.smtp_settings = {
      :address => "smtp.gmail.com",
      :port => 587,
      :domain => "mail.google.com",
      :user_name => "example@gmail.com",
      :password => "somepassword",
      :enable_starttls_auto => true
  }

一切正常。但是没有生成电子邮件。 在我的控制台中,我正在获取邮件信息和链接..

我的控制台:

Sent mail to example@yahoo.com (2597.8ms)
Date: Wed, 08 Apr 2015 23:39:09 +0530
From: example@gmail.com
Reply-To: example@gmail.com
To: example@yahoo.com
Message-ID: <55256ec5ba47e_26f51d984dc117aa@itadmin-HP-Pavilion-17-Notebook-PC.mail>
Subject: Reset password instructions
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<p>Hello exmple@yahoo.com!</p>

<p>Someone has requested a link to change your password. You can do this through the link below.</p>

<p><a href="http://localhost:3000/users/password/edit?reset_password_token=M5os3tBYHQrsRaw4TtTt">Change my password</a></p>

<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

我没有添加任何设计密码控制器/注册控制器。 当我单击忘记密码并输入电子邮件并单击“向我发送重置密码说明”按钮时出现错误。 这是错误,我得到了:

Net::SMTPAuthenticationError in Devise::PasswordsController#create

534-5.7.14 &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbsrrD-

我使用了Running into SMTP error when trying to send email in RoR app,但没有帮助我。 我可能有什么问题?

【问题讨论】:

标签: ruby-on-rails devise


【解决方案1】:

在谷歌中检查了一些选项后,这个可以工作

点击https://www.google.com/settings/u/0/security/lesssecureapps

通过使用您在 smtp 配置中提供的电子邮件地址登录,在此处启用对安全性较低的应用程序的访问。

【讨论】:

    【解决方案2】:

    登录您的谷歌帐户,找到“允许不太安全的应用”并将其打开。

    【讨论】:

      猜你喜欢
      • 2015-02-07
      • 2015-04-06
      • 2015-02-03
      • 1970-01-01
      • 2018-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-11
      相关资源
      最近更新 更多