Monday, 17 May 2010

Send mails through Rails!

I was looking for tutorials on how to send mails through RoR. It turns out, it is pretty easy. Check out the Railscast.

If you are using GMail as your mail-server, it uses TLS(Transport Level Security). We need a little modification in the environment.rb for that. Make sure you have Ruby 1.8.7 or later, and Rails 2.2.1 or later. Just change the smtp_settings block. Rest of the procedure will be the same.

config.action_mailer.smtp_settings {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:authentication => :plain,
:domain => 'yourapp.com'
:user_name => 'username',
:password => 'password'
}



0 comments: