If you need an easy way to setup email for your company or for a client it’s hard to not love Google Apps. (The ’standard’ ie free version is here).
It is very likely that at some point you will need to send out emails from your application. Don’t cry. Gmail can do this for you. Rails 2.3.2 makes it easier than ever with the addition of ‘enable_starttls_auto’. Put the following code in production.rb, development.rb or environment.rb and you ’should’ be able to send out emails:
If you are one of the lucky ones this will actually work. It didn’t work for me but since I still needed to get email working here’s what I did:
First be sure to activate the email account that you are using. To do that you only need to login. Google will walk you through entering a captcha etc.
You might get this error:
Net::SMTPAuthenticationError: 530 5.7.0 Must issue a STARTTLS command first.
If you do then check your Ruby version. Ruby 1.8.7 has this built in but Ruby 1.8.6 does not.
The next best thing is to get action_mailer_tls. Most of the links you will find in forum and blog posts are broken. The code is on github and neatly packaged as a gem: http://github.com/openrain/action_mailer_tls/tree/master. Follow the directions to install and configure the plugin there and you should be able to send email.
Here’s a couple of handy conversations for reference: