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

使用 CID(内容-ID)自动将图片嵌入到邮件中的 Swiftmailer 插件

有关更多信息,请参阅 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 PluginMIT 许可 下发布。