hexanet/swiftmailer-image-embed

该软件包已被放弃,不再维护。作者建议使用 thereddot/swiftmailer-image-embed 软件包。

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

v2.1.1 2019-01-11 13:00 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:52:54 UTC


README

Build Status 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 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 开发。

许可证

Swiftmailer Image Embed Plugin 采用 MIT 许可证 许可。