Setting Up a Development Mailer for Rails With a Gmail Account

Setting up the rails mailer for development purposes is much easier. using the action mailer to configure the gmail services, is just a few commands and configurations away…

Make sure that these settings are not used in production.

  1. Firstly Sign Up for a dummy gmail account.
  2. Next add the following configuration in development.rb

File: config/environments/development.rb

1
2
3
4
5
6
7
8
9
10
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => '<your_domain>',
  :user_name            => '<user_name>',
  :password             => '<password>',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

Login to the gmail account and check the sent mails, to preview the sent mail.

There’s a lot more that can be done with this, check the Rails Guids for more information.

Any questions on this, please feel free to ask. We’re here to help…

Comments