Is there a tool or a bundle in Symfony2 that allows me to create normal templates with css files, and then on the fly convert it to inline css rules so it can be used as the body of an email?
I know of three tools that can do this and which you can use in Symfony:
The first two don´t have a direct symfony implementation, though they will be easy to use. For mailchimp, there is a mailchimp bundle which offers this functionality, though the bundle is not very well documented.
Today I discovered through another question that exists such a Symfony2 bundle that fits your needs (I didn't tested it).
You can use ToInlineStyleEmailBundle, it embeds the CSSToInline library that Carlos Granados suggested in his answer.
With this Symfony2 bundle you can get the converter as a service ($this->get('css_to_inline_email_converter')
) and then use it for your needs. It also supports templates generations.
I've had great results with integrating the Emogrifier PHP class within CakePHP. Inlines all styles very nicely. Not sure if it has a Symfony bundle but shouldn't be hard to integrate.
https://github.com/jjriv/emogrifier
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With