Search code examples
ruby-on-railsdeviseactionmailer

Action Mailer with Devise | Forgot my Password


I'm trying to get the "Forget my Password" option work, but I think I lost it on what to set up.

As I googled I read that Devise has its own Action Mailer so I don't have to generate controllers and model's for it.

So I edited my config/enviroments/production.rb

config.action_mailer.default_url_options = { :host => 'example.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
    :address              => "smtp.example.com",
    :port                 => 25,
    :user_name            => 'test@example.com',
    :password             => '123456',
    :authentication       => 'plain',
    :enable_starttls_auto => true  
}

and in my config/initializers/devise.rb

 config.mailer_sender = "test@example.com"

Of curse this didn't' work.

 SocketError (getaddrinfo: Name or service not known):

I have a strong belief that I messed things up or forgot a bunch load of settings :)

Could anybody guide me on how to Set up the "Forget my Password" option?


Solution

  • This is because smtp.example.com is not valid,

     Socket.getaddrinfo("smtp.example.com", "smtp")
     #SocketError: getaddrinfo: Name or service not known