ActionMailer

From DreamHost
Jump to: navigation, search
WARNING: POSSIBLE OUTDATED INFORMATION!
DreamHost does not directly support any of the features described on this page and is not responsible for keeping this content updated or accurate. Use at your own risk!
There may be additional information on the talk page.

Action Mailer is used by Ruby On Rails to easily send or receive emails from with in your Rails application.

More on how to use Action Mailer can be read Here

To configure Action mailer to work with a dream host account add this configuration to your environment.rb file:

Rails::Initializer.run do |config|
  # Your application configuration
  ...
  # configure action_mailer
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address => 'mail.your.domain',
  :port => 587,
  :domain => 'your.domain',
  :authentication => :login,
  :user_name => 'username@your.domain',
  :password => 'password'
}
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.default_charset = 'utf-8'
end

Action mailer 2.2.2 has a bug that prevents sending mail via ssl connection from dream host servers. If your production.log file contains error message "hostname was not match with the server certificate" then try changing :address key in smtp_settings.

Previous directions included checking the mail cluster on the (Panel > ‘Support’ > ‘Data Centers’) page. These were incorrect. The address in the smtp_settings should be: mail.your.domain. Also, if you're getting the SSL certificate error, you might benefit from turning off auto TLS for e-mail by setting enable_starttls_auto in smtp_settings to false

If you have changed your email over to Google Apps then the following settings are needed in environment.rb:

# configure action_mailer
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :enable_starttls_auto => true,
  :address => 'smtp.gmail.com',
  :port => 587,
  :domain => 'your.domain',
  :authentication => :plain,
  :user_name => 'user@your.domain',
  :password => 'password'
}
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.default_charset = 'utf-8'

Note that the mail prefix is not needed before your domain.