Premailer (Sundawg Fork) README

This a small modification to the outstanding gem provided by Alex Dunae.

code.dunae.ca/premailer.web/

Please visit the premailer github page for the authoritative guide on how to use premailer:

github.com/alexdunae/premailer/

This project was forked on February 8th, 2010 from version 1.5.4.

Instructions Specific To This Version

This version was created to provide an easier way to perform in-memory css-inlining given a String with HTML content. This was added to provide better integration with existing ActionMailer functionality.

To use premailer with your existing HTML emails, you must change your Action Mailer action as so:

def hello_world(params)
  content = Premailer.new(render_message("hello_world.text.html.erb", params), :in_memory => true).to_inline_css
  subject       "Hello World"
  recipients    "[email protected]" 
  from          "[email protected]" 
  sent_on       Time.now.utc
  content_type  "text/html"
  body          content
end

Calling render_message will execute your view template with whatever arguments and models you require for the view to render properly. The additional argument, is :in_memory => true so that premailer does not attempt to perform HTTP GET or load from local disk your view template. Once you have premailer instantiated, you can then call the standard to_inline_css so that your email sends HTML email with the CSS attributes properly in element style attributes.

Additional Changes

Added echoe gem to help build, package, and install locally this project as a gem.

Disclaimer

Along with any disclaimer provided with the original software, I have not fully tested to make sure all original functionality continues to work as is.