Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Rails + GMail = Simple Email Delivery

DZone's Guide to

Rails + GMail = Simple Email Delivery

·
Free Resource

Want to send email from your gmail account on your Rails site? Using this simple method you will be able to quickly achieve reliable email in your Rails app and not have to worry about maintaining multiple email configurations for every environment!

Start off by installing the action_mailer_tls plugin:

cd vendor/plugins/
svn export https://openrain.com/opensource/public/rails/plugins/action_mailer_tls action_mailer_tls

Now setup your environment.rb.

require "smtp_tls"

ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.server_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'yourdomain.com',
:user_name => "you@yourdomain.com",
:password => "password",
:authentication => :plain
}

That's it!

Now you'll be able to send email through your GMail account while running in development, test, or production modes.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}