587, :domain =-6ren">
gpt4 book ai didi

ruby-on-rails - Net::SMTPAuthenticationError in Devise::PasswordsController#create when working with devise mailers

转载 作者:行者123 更新时间:2023-12-03 21:33:12 28 4
gpt4 key购买 nike

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

在模型中:

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'

开发中.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>

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

Net::SMTPAuthenticationError in Devise::PasswordsController#create

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

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

最佳答案

在谷歌中检查了一些选项后,这个有效

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

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

关于ruby-on-rails - Net::SMTPAuthenticationError in Devise::PasswordsController#create when working with devise mailers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29543113/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com