9.1. Configuring the E-Mail Server

Rails can use a local sendmail or an external SMTP server for delivering the e-mails.

Sending via Local Sendmail

If you want to send the e-mails in the traditional way via local sendmail, then you need to insert the following lines into your configuration file config/environments/development.rb (for the development environment) or config/environments/production.rb (for your production environment):
config.action_mailer.delivery_method = :sendmail
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

Sending via Direct SMTP

If you want to send the e-mail directly via a SMTP server (for example Google Mail), then you need to insert the following lines into your configuration file config/environments/development.rb (for the development environment) or config/environments/production.rb (for your production environment):
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:              "smtp.gmail.com",
  port:                 587,
  domain:               'example.com',
  user_name:            '<username>',
  password:             '<password>',
  authentication:       'plain',
  enable_starttls_auto: true  }
Of course you need to adapt the values for :domain, :user_name and :password in accordance with your configuration.

Thank you for your support and the visibility by linking to this website on Twitter and Facebook. That helps a lot!