I have been working on deploying a Rails application to Heroku. A couple of gotchas I ran into when following this post ”Sending email with Gmail”
- Don’t use a dollar sign ($) in your password
- this can work locally if you put single quotes around the value, but on the heroku server it saved the entire string but at runtime would truncate it at the dollar sign
- for example using the password ’left-side$right-side’
- heroku config:add GMAIL_SMTP_PASSWORD=left-side$right-side
- heroku config returns > GMAIL_SMTP_PASSWORD=left-side$right-side
- heroku console
- type ENV[‘GMAIL_SMTP_PASSWORD’] returns > left-side
Heroku is running Ruby 1.8.6, locally I am running Ruby 1.8.7, I made a small hack to the plugin to avoid errors in development mode
./vendor/plugins/gmail_smtp/init.rb
changed the first line to
require ‘smtp_tls’ if RUBY_VERSION < "1.8.7"
tls is already handled in 1.8.7 and this code must have been creating some type of conflict