I'm getting an error while trying to use the action_mailer_tls
plugin to communicate with Gmail in my Rails app:
Must issue a STARTTLS command first
Others seem to have encountered this same problem:
The problem is that Gmail requires TLS authentication but the standard Ruby net/smtp library doesn't support TLS.
The article recommends following these steps, which I did:
Of course there is a helpful plugin created by Marc Chung to overcome this barrier. You can find it here and manually add it to your project or you can export it to your plugin directory.
$ cd vendor/plugins
$ svn export http://code.openrain.com/rails/action_mailer_tls/
Either way make sure you require 'smtp_tls'
Now all you need is to update your smtp_settings if you haven't done so already.
- ActionMailer::Base.smtp_settings = {
- :address => "smtp.gmail.com",
- :port => 587,
- :domain => "domain.com",
- :user_name => "[email protected]",
- :password => "password",
- :authentication => :plain
- }
Any suggestions for a better solution to talk to Gmail would be appreciated.