People care about emails. They don’t like to be bothered with emails they find unimportant, especially not if they are sent by mistake, have the wrong content or looks weird.
Many of the applications we build send out a lot of emails, and for some, it is a critical part of the system. Lokalebasen is such an application, and the people behind wanted to monitor all outgoing mail, whether generated by a page request, a cron job, an administrator or anything else.
I built a clever little monkey-patch for the Ruby on Rails ActionMailer that makes sure that all outgoing emails has a certain email address put on BCC. This is not visible to the recipient, but it allows you to keep an archive of all outgoing mail, which is certainly useful – especially for support and bug-tracking.
Drop this into your lib-folder (remember to change the email address):
- and be sure to enable it by adding this line to environment/production.rb (you probably don’t want to BCC mails sent in development and test mode):
ActionMailer::Base.send(:include, BccAllMails)
Hello, I'm Casper Fabricius. I have developed for the web for 9 years, and have been enjoying Ruby on Rails for the past 4.
My experience covers communities, shopping solutions, multi-language sites, heavy back-end lifting and a wide selection of more traditional websites. I like to integrate Ruby with Java and .NET through JRuby and IronRuby when it makes sense. I am passionate about test- and behavior-driven development, but at the same time I am pragmatic and believe in getting things done.
I am based in Copenhagen, Denmark, but I take assignments from across the globe. Feel free to study my resumé, featured projects and - of course - to hire me.