Sending HTML emails can be tricky, not all mail clients support the same css. Most ignore external stylesheets, inline styles are the only way to format layouts for maximum compatability.
Applying inline styles to elements can be hard to maintain, this is where Premailer comes in, Premailer can take a file or HTML markup and take any styles inside style tags and place them inside the tags as inline style attributes.
Premailer provides an api to allow usage within your applications. http://premailer.dialect.ca/api
The Premailer API is accessed via an HTTP POST to http://premailer.dialect.ca/api/0.1/documents.