How To Test Rails ActiveMailer Emails In Your Development Environment

Posted by Weston Ganger on May 03, 2016

You definitely need to test your emails that you send in your app. Skipping them in development is not a good idea.

There are two methods for you to do this:

My personal favourite is the simple fake SMTP server with Python which just pipes the email through your log which is what I usually want.

# Create Init.d Startup Script to Start Fake SMTP Server on System Startup
sudo echo "python -m smtpd -n -c DebuggingServer localhost:25 > /dev/null 2>&1 &" > /etc/init.d/fake-smtp # replace /dev/null with a file if you want to keep your email logs.
sudo chmod +x /etc/init.d/fake-smtp
sudo update-rc.d fake-smtp defaults

# Start Script Right Away without Rebooting
sudo /etc/init.d/fake-smtp start

Or if you want to see your slick email in the browser with full html you can use the MailCatcher or letter_opener gems

Related External Links:

Posted in Rails and Tagged with rails linux smtp 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts