eschmar / mailer-bundle
在 Symfony 4 中方便地发送 html/plaintext 电子邮件。
v1.0.1
2018-10-17 20:19 UTC
Requires
- php: >=7.1.0
- eschmar/css-inliner-bundle: ^1.0.0
- symfony/swiftmailer-bundle: ^3.2.3
- twig/twig: ^2.4.4
This package is auto-updated.
Last update: 2024-09-11 19:56:39 UTC
README
在 Symfony4 中方便地发送 html/plaintext 电子邮件。此捆绑包附带 Mailgun 的 Action Email 版本,可直接发送电子邮件。
安装
Composer (Packagist)
composer require eschmar/mailer-bundle ^1.0.0
使用
eschmar_mailer 服务期望模板包含 3 个块 subject、body_html 和 body_plain,并已包含一个布局文件 @EschmarMailer/Mail/layout.html.twig,可直接使用。我建议不要使用嵌入的 base64 图像,这只是为了演示目的。当然,这个布局是完全可选的,您可以构建自己的模板。使用 Twig 标签 {% cssinline %}{% endcssinline %},CSS 样式将被内联(一些电子邮件客户端会去除 <head> 和 <style> 标签)。
use Eschmar\MailerBundle\Service\Mailer; // ... if (!$mailer->send("@EschmarMailer/Mail/test.html.twig", [], $from, $to[, $bcc])) { // Oops! return; } // success
许可证
MIT 许可证。
