nautilal / laravel-mail-css-inliner
Laravel 5 邮件 CSS 内联服务
v1.2
2018-11-10 06:23 UTC
Requires
- illuminate/support: ^5.6
- pelago/emogrifier: ^2.0
- swiftmailer/swiftmailer: ^6.1
This package is auto-updated.
Last update: 2024-09-10 19:53:49 UTC
README
为什么?
大多数电子邮件客户端不会渲染 CSS(在 <link>
或 <style>
中)。解决方案是将 CSS 直接内联到 HTML 中。手动这样做既麻烦又难以维护。该包的目标是在发送电子邮件之前自动化内联 CSS 的过程。
如何?
使用一个出色的 CSS 内联包封装在 SwiftMailer 插件中,并作为服务提供者。它无需配置即可工作
转换
<html> <head> <style> h1 { font-size: 24px; color: #000; } </style> </head> <body> <h1>Your content</h1> </body> </html>
成这样
<html> <head> </head> <body> <h1 style="font-size: 24px; color: #000;">Your content</h1> </body> </html>
安装
首先通过 Composer 安装此包。编辑项目的 composer.json
文件以要求 nautiyal/laravel-mail-css-inliner
。
此包需要 Laravel 5.x
$ composer require nautiyal/laravel-mail-css-inliner
一旦此操作完成,您必须添加服务提供者。打开 app/config/app.php
,并在 providers 数组中添加一个新条目。
Nautiyal\MailCssInliner\MailCssInlinerProvider::class,
发现了一个错误吗?
请告诉我!发送一个拉取请求或补丁。有问题?问吧!我会对所有提交的问题做出回应。
许可证
此包是开源软件,许可协议为 MIT 协议