Over a million developers have joined DZone.

Rails + GMail = Simple Email Delivery


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.


The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}