Redirect all mails while developing your rails app

Posted on ·

The plugin is called MailBouncer, and is written by a colleague of mine, Trym Skaar. The installation is as easy as

config.gem "trym-mail_bouncer", 
  :lib => "mail_bouncer", :source => "http://gems.github.com"

in your environment.rb, or you can still do

gem install trym-mail_bouncer --source http://gems.github.com

After installing, go into $RAILS_ROOT/config/initializers/mail_bouncer.rb and do your setup

MailBouncer.configure do |config|
  config.enabled    = %w(development test).include? ENV["RAILS_ENV"]
  config.recipients = 'your@email.com'
end

And you’re done. All mails sent while being in development- or test-mode on your project will be redirected to your own debug mail account instead of out to your customers, and it will keep all headers intact so you can use it for debugging.

It has saved my day a couple of times already :-)

blog comments powered by Disqus