Ruby on rails Net::SMTPAuthenticationError在使用DeVICE::PasswordsController时创建
我正在为我的应用程序实施Desive mailers,我已完成以下步骤: 在模型中:Ruby on rails Net::SMTPAuthenticationError在使用DeVICE::PasswordsController时创建,ruby-on-rails,devise,Ruby On Rails,Devise,我正在为我的应用程序实施Desive mailers,我已完成以下步骤: 在模型中: class User < ActiveRecord::Base # Include default devise modules. Others available are: # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :confirmable,
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
在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>
已将邮件发送到example@yahoo.com(2597.8毫秒)
日期:2015年4月8日星期三23:39:09+0530
发件人:example@gmail.com
答复:example@gmail.com
致:example@yahoo.com
消息ID:
主题:重置密码说明
Mime版本:1.0
内容类型:text/html;
字符集=UTF-8
内容传输编码:7bit
你好exmple@yahoo.com!
有人请求链接以更改您的密码。你可以通过下面的链接来实现这一点
如果您没有请求,请忽略此电子邮件
在访问上面的链接并创建新的链接之前,您的密码不会更改
我没有添加任何设计密码控制器/注册控制器。
当我点击忘记密码并输入电子邮件并点击“发送我重置密码说明”按钮时,我收到一个错误。
这就是错误,我得到:
Net::smtpauthentication designe::passwords控制器中出现错误#create
534-5.7.14登录您的google帐户,找到“允许不太安全的应用”,然后将其打开。在google中检查一些选项后,此选项有效
点击
通过使用您在smtp配置中提供的电子邮件地址登录,在此处启用对不太安全的应用程序的访问。似乎与我在此处回答的问题类似:
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>