Package lamson :: Module html
[hide private]
[frames] | no frames]

Module html

source code

This implements an HTML Mail generator that uses templates and CleverCSS to produce an HTML message with inline CSS attributes so that it will display correctly. As long as you can keep most of the HTML and CSS simple you should have a high success rate at rendering this.

How it works is you create an HtmlMail class and configure it with a CleverCSS stylesheet (also a template). This acts as your template for the appearance and the outer shell of your HTML.

When you go to send, you use a markdown content template to generate the guts of your HTML. You hand this, variables, and email headers to HtmlMail.respond and it spits back a fully formed lamson.mail.MailResponse ready to send.

The engine basically parses the CSS, renders your content template, render your outer template, and then applies the CSS directly to your HTML so your CSS attributes are inline and display in the HTML display.

Each element is a template loaded by your loader: the CleverCSS template, out HTML template, and your own content.

Finally, use this as a generator by making one and having crank out all the emails you need. Don't make one HtmlMail for each message.

Classes [hide private]
  HtmlMail
Acts as a lamson.mail.MailResponse generator that produces a properly formatted HTML mail message, including inline CSS applied to all HTML tags.