gmail smtp with rails 3

elasticmonkey picture elasticmonkey · Jun 17, 2011 · Viewed 31.6k times · Source

I am trying to get a confirmation email sending using a gmail account. I have looked around and there is nothing that is obvious. There is no errors or anything, it just dosn't send

I have this as the initalizer:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true


ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => "gmail.com",
  :user_name            => "<address>@gmail.com",
  :password             => "<password>",
  :authentication       => "plain",
  :enable_starttls_auto => true
}

ActionMailer::Base.default_url_options[:host] = "localhost:3000"

Answer

brutuscat picture brutuscat · May 29, 2012

You don't need tlsmail gem anymore at least with Rails 3.2

This will be sufficient

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => 'baci.lindsaar.net',
  :user_name            => '<username>',
  :password             => '<password>',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

From the all-mighty-guide ActionMailer configuration for gmail