thereddot / swiftmailer-image-embed

该包已被废弃,不再维护。未建议替代包。

Swiftmailer 插件,可自动将图片嵌入到邮件中

v2.1.4 2021-02-19 17:14 UTC

This package is auto-updated.

Last update: 2021-03-19 17:29:22 UTC


README

❗ 该包已被废弃,不再积极维护。

Total Downloads Latest Stable Version

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 thereddot/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/swiftmailer-image-embed 分支。

许可证

Swiftmailer Image Embed Plugin 使用 MIT 许可证