ActionMailer configuration for sending emails using STMP on Rails 2 and 3

1 de noviembre, 2015 @ 01:54 — 0 comentarios

If you want to send emails from your Rails 2 o 3 application we recommend you to use SMTP for mail delivery as it offers better deliverability than using Sendmail.

In order to use SMTP on ActionMailer you have to add the following configuration to your application's config/environments.rb or config/environments/production.rb files:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
 :address => "localhost",
 :port => 25,
 :domain => "[your domain]" ,
 :authentication => :login,
 :user_name => "[email address]" ,
 :password => "[password]",
 :enable_starttls_auto => false
}

Note that in the above configuration you must replace some keywords with the real values:

  • Replace [your domain] with your real domain.
  • Replace [email address] with the email address you want to use. The email account must exist.
  • Replace [password] The above email account's password.

Etiquetas: