我是一名有用的助手,可以为您翻译文本。
我正在为我的应用程序实现设备邮件发送器,已完成以下步骤:
在模型中:
在 development.rb 文件中:
我正在为我的应用程序实现设备邮件发送器,已完成以下步骤:
在模型中:
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
然后我添加了确认令牌、确认时间和发送确认时间的迁移。
在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>
我没有添加任何设备密码控制器/注册控制器。当我点击“忘记密码”并输入电子邮件并单击“发送重置密码说明”按钮时,我会收到一个错误提示。
这是我遇到的错误:
Devise :: PasswordsController#create中的Net :: SMTPAuthenticationError
534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsrrD
-
我使用了在RoR应用程序中尝试发送电子邮件时遇到SMTP错误,但没有帮助我解决问题。
可能是什么问题呢?