user3763203
user3763203

Reputation: 71

How to send mail from localhost in ruby on rails with smtp?

I am working on Ruby on Rails 4.0.1 framework and want to use active mailer to mail newly registered users on localhost:3000 using smtp.gmail.com, I had set up everything . Mail is processed in logs and it also shows "Processed outbound exception" but till now I haven't received any mail. Any leads will be appreciated.

Thanks

Upvotes: 2

Views: 951

Answers (1)

MZaragoza
MZaragoza

Reputation: 10111

in your config/environments/*.rb you can set up the action_mailer to look something like

config.action_mailer.deconfig.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => 'domain'
  :user_name            => '[email protected]',
  :password             => 'xxxxxxx',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

Note: If you are using the development environment, change the config/environments/development.rb to raise delivery errors, with:

config.action_mailer.raise_delivery_errors = true

Upvotes: 2

Related Questions