Thanks for your interest in the full CSS-to-Inline Converter script!
Download
Usage
The file is a stand-alone PHP class. The following instructions, as well as additional usage tips, can be found in the beginning of the class file itself.
Include this class in your script
require('include_path/CSStoInline.class.php');
You may pass the HTML and the CSS data into the class as variables holding string values…
$converted = new CSStoInline($html_string,$css_string,'path/to/output_file.html');
Or as external files somewhere on your machine…
$converted = new CSStoInline('path/to/email.html','path/to/email_stylesheet.css','path/to/output_file.html');
The converted HTML string will be saved at the file path you specified as the third argument when you instantiated the CSStoInline object.
Alternatively, the inline HTML string output can be found in the object property ‘output’. For instance:
print ( $converted->output );
Or, put the data in a new converted file:
file_put_contents ( 'path/to/converted_email.html',$converted->output );
Questions and Feedback
Have suggestions for improvement? Problems using the script? Feel free to contact us any time.