Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

Configuring Ruby on Rails ActionMailer

Feb 12

Ruby on Rails stresses “convention over configuration” which I completely agree with it. There’s always a difference between saying something and actually practicing it. I think RoR does a great job of letting the developer focus on code while requiring minimal configuration.

This evening I was working on a personal project that uses ActionMailer to send automated email when a new account is created. By default ActionMailer is not configured so the necessary entries need to be added to get this to work. I ended up having to edit the environment.rb file located in the config directory. You can simply append your configuration to the bottom of the file where it says “# Include your app’s configuration here:”. For testing purposes I created a minimal configuration the consisted of the SMTP server, port, and domain where the email was coming from. The format of the config looks like:

ActionMailer::Base.server_settings = {
:address => “smtp.mydomain.com”,
:port => 25,
:domain => “www.mydomain.com”
}

Pretty basic and if you need more complex settings such as SMTP authentication then check out the configuration settings.

Leave a Reply