Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Devise authentication to send the email for password retrieval

I'm testing Devise authentication for Rails on my local host and want to get it to send emails for password retrieval (i.e. the "forgot your password" link). Password retrieval is built into Devise, it's just a matter of configuring it properly to get the email to send.

In initializers/devise.rb, I put

config.mailer_sender = "[email protected]" 

but when I tried to test the "forgot your password" link on Devise authentication for rails I got the error message below. If I do need to add other information for the email to actually send, what do I need to add and where??

In users model, these are the modules that are being used devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

--- error message --- Errno::ECONNREFUSED in Devise::PasswordsController#create Connection refused - connect(2) Rails.root: /Users/myname/Sites/rails3d Application Trace | Framework Trace | Full Trace Request Parameters: {"utf8"=>"✓", "authenticity_token"=>"8oO5vXqO4esl3ztn5yE7OkVxZe+Ju94jj76rbKR225I=", "user"=>{"email"=>"[email protected]"}, "commit"=>"Send me reset password instructions"} Show session dump Show env dump Response Headers

like image 803
Leahcim Avatar asked Dec 06 '11 03:12

Leahcim


People also ask

How does devise authentication work?

Devise is an excellent authentication system made for Rails that allows us to easily drop-in User functionality into our project. Devise only includes an email and password for registration, let's also add our own username to our User model. We also want to have a unique index on our username.


1 Answers

HAve you setup your mail settings in environments/development.rb

  config.action_mailer.smtp_settings = {
     :address              => "smtp.gmail.com",
     :port                 => 587,
     :domain               => 'domain.com',
     :user_name            => '[email protected]',
     :password             => 'password',
     :authentication       => :plain,
     :enable_starttls_auto => true  }
like image 127
TJ Sherrill Avatar answered Oct 20 '22 12:10

TJ Sherrill