Why you should use this?
Most email clients strip out head
and style
tags from emails, so most of your users wouldn't see the email properly.
But writing inline CSS is time consuming and repetitive. So just install this plugin and viola! Your outgoing email CSS will be inline automatically.
Thanks to: tijsverkoyen/CssToInlineStyles
Installation
Just install Triasrahman.Premailer
plugin. No additional setup required!
Or using CLI:
php artisan plugin:install Triasrahman.Premailer
Usage
You can test by sending email using Mail::send()
function, and you'll see the difference.
Before
<head> <style> // Your CSS h1 { font-size: 48px; font-weight: 600; } p { font-size: 14px; margin-bottom: 15px; color: #333 } a, a:link { color: #093; } </style> </head> <body> <h1>Welcome to OctoberCMS!</h1> <p>You recently signed up for OctoberCMS account.</p> <p>Please verify your email address and activate your account by clicking the link below:</p> <p><a href="#">http://verify.com/confirmation-link</a></p> <p>-- Trias</p> </body>
After
<head> </head> <body> <h1 style="font-size: 48px; font-weight: 600;">Welcome to OctoberCMS!</h1> <p style="font-size: 14px; margin-bottom: 15px; color: #333;">You recently signed up for OctoberCMS account.</p> <p style="font-size: 14px; margin-bottom: 15px; color: #333;">Please verify your email address and activate your account by clicking the link below:</p> <p style="font-size: 14px; margin-bottom: 15px; color: #333;"><a href="#" style="color: #093">http://verify.com/confirmation-link</a></p> <p style="font-size: 14px; margin-bottom: 15px; color: #333;">-- Trias</p> </body>
-
CanThis
Found the plugin useful on 6 Jan, 2017
Big Thanks! I found it very useful. Especially with Zurb Foundation for Emails :)
-
2.0.0 |
Upgrade for compatibility with Laravel 5.5 (PHP 7+, October 420+) Oct 02, 2017 |
---|---|
1.0.1 |
First version of Premailer Feb 06, 2016 |