Trying to use GMail SMTP (or some other SMTP authenticated with TLS) with ActiveRecord to send email in Ruby on Rails? Up till now this involved requiring smtp_tls.rb in your environment.

Thankfully, Kyle Maxwell has come up with a neater solution.


It’s a plugin, which you can get with this command in your Rails root…

./script/plugin install

Due to continued downtime of Kyle’s site please use the following URl:

./script/plugin install git://


You can turn TLS authentication on and off as you need in your environment with a new key that is added to the smtp config, tls. To use with gmail, the following should be in your environment.rb

ActionMailer::Base.smtp_settings = {
    :tls => true,
    :address => "",
    :port => "587",
    :domain => "YOURDOMAIN",
    :authentication => :plain,
    :user_name => "GOOGLEUSERNAME",
    :password => "GOOGLEPASSWORD"

And that’s it. Enjoy.