I am implementing devise mailers for my application where i have done the following steps:
in model:
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
and then I added migrations of confirmation_token, confirmed_at, confirmation_sent_at
In devise.rb, I added:
config.mailer_sender = '[email protected]'
#config.mailer = 'Devise::Mailer'
In 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 => "[email protected]",
:password => "somepassword",
:enable_starttls_auto => true
}
everything working fine. But the email is not generated. In my console i am getting mail information and link..
my console:
Sent mail to [email protected] (2597.8ms)
Date: Wed, 08 Apr 2015 23:39:09 +0530
From: [email protected]
Reply-To: [email protected]
To: [email protected]
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 [email protected]!</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>
I haven't added any devise passwords controller / registartion controllers. I am getting a error when i click on Forgot password and enter email and click on "Send me reset password instructions" button. this is the error, i am getting:
Net::SMTPAuthenticationError in Devise::PasswordsController#create
534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsrrD-
I used Running into SMTP error when trying to send email in RoR app but didn't helped me. What might me the problem?
After checking some options in google, this one works
Click https://www.google.com/settings/u/0/security/lesssecureapps
Enable access for less secure apps here by logging in with the email address you have provided in smtp configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With