As most of you already know, a bunch of online mail readers (like Hotmail, Gmail, …) don’t handle stylesheets very well, they prefer inline styling (
For my own use I created a module called InlineCss that I include in the mailers I need inlining for. This is the code:
module InlineCss def render(*args) if (template = args.first[:template]) && template.mime_type.html? # Be warned, this code expects a <style> tag in the head of your layout. TamTam.inline(:document => super) else super end end end
This code sees if I am working with a template and if that template has a HTML MIME-type, it inline’s it with TamTam.
In my mailers I just include it. If you want to have this in all mailers, just add an initializer that includes InlineCss in ActionMailer::Base, and it should work