openbuildings / swiftmailer-css-inliner
Inline the css of your html emails
Installs: 388 034
Dependents: 3
Suggesters: 3
Security: 0
Stars: 65
Watchers: 14
Forks: 12
Open Issues: 4
Requires
- php: ^7.3 || ^8.0
- swiftmailer/swiftmailer: ^5.1 || ^6.0
- tijsverkoyen/css-to-inline-styles: ^2.1
Requires (Dev)
- phpunit/phpunit: ^9.3
- symfony/css-selector: ^2.0.5|^3.0
README
Swift Mailer plugin inlining the CSS (in style tags) into the specific html tags. Uses CssToInlineStyles. Works for both html body or html parts.
Installation
$ composer require openbuildings/swiftmailer-css-inliner
Usage
use Openbuildings\Swiftmailer\CssInlinerPlugin; $mailer = Swift_Mailer::newInstance(); $mailer->registerPlugin(new CssInlinerPlugin());
You can set custom parameters by providing your own CssToInlineStyles object. Like this
use Openbuildings\Swiftmailer\CssInlinerPlugin; use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles; $mailer = Swift_Mailer::newInstance(); $converter = new CssToInlineStyles(); $converter->setUseInlineStylesBlock(false); $mailer->registerPlugin(new CssInlinerPlugin($converter));
License
Copyright © Clippings Ltd. Created by Clippings team and contributors.
Under BSD-3-Clause license, read LICENSE file.