hexanet / swiftmailer-image-embed
v2.1.1
2019-01-11 13:00 UTC
Requires
- php: ^7.1
- swiftmailer/swiftmailer: ^6.0
Requires (Dev)
- phpunit/phpunit: ^6.0
This package is not auto-updated.
Last update: 2022-02-01 12:52:54 UTC
README
Swiftmailer 插件,通过使用 CID (内容标识符) 自动将图片嵌入到消息中
有关更多信息,请参阅 https://swiftmailer.symfony.com/docs/messages.html#embedding-inline-media-files
示例
<html> <head></head> <body> <p>some text</p> <img src="images/swiftmailer_rocks.png" alt="placeholder"> </body> </html>
使用该插件将生成以下电子邮件
<html> <head></head> <body> <p>some text</p> <img src="cid:1eda5ca8666e64003917d06b34bbd2f7@swift.generated" alt="placeholder"> </body> </html>
安装
composer require hexanet/swiftmailer-image-embed
使用方法
use Hexanet\Swiftmailer\ImageEmbedPlugin; $mailer = new Swift_Mailer($yourTransport); $mailer->registerPlugin(new ImageEmbedPlugin());
或在 symfony 的 services.yaml 中
Hexanet\Swiftmailer\ImageEmbedPlugin: arguments: - '%kernel.root_dir%/../web/' tags: [swiftmailer.default.plugin]
参数是可选的。
致谢
由 Hexanet 开发。