定制 bummzack/swiftmailer-emogrifyplugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bummzack/swiftmailer-emogrifyplugin

Composer 安装命令:

composer require bummzack/swiftmailer-emogrifyplugin

包简介

Inline CSS in the HTML output of SwiftMailer using Emogrifier.

README 文档

README

Scrutinizer Code Quality Code Coverage Build Status Latest Stable Version

Inline CSS in the HTML output of SwiftMailer using Emogrifier.

Installation and requirements

Install via composer, using:

composer require bummzack/swiftmailer-emogrifyplugin

Requirements:

  • PHP 7.2+
  • SwiftMailer 6.x
  • Emogrifier 6.x

Usage

By default, the plugin will inline CSS that is part of the HTML, eg. styles defined in <style> tags.

Supplying custom CSS

$plugin = new EmogrifierPlugin();
$plugin->setCss('.customStyle: { color: red; };');

Example

Here's how you could use the plugin to send emails with custom styles loaded from a file:

$plugin = new Bummzack\SwiftMailer\EmogrifyPlugin\EmogrifierPlugin();
$emogrifier->setCss(file_get_contents( /* path to your CSS file */ ));

// Create the Mailer using any Transport
$mailer = new Swift_Mailer(
    new Swift_SmtpTransport('smtp.example.org', 25)
);

// Use Emogrifier plugin to inline styles.
$mailer->registerPlugin($plugin);

$message = new Swift_Message();
$message
    ->setSubject('Your subject')
    ->setFrom(['test@example.com' => 'Test'])
    ->setTo(['receiver@example.com'])
    ->setBody('<p>My custom HTML</p>', 'text/html');

// Send your email
$mailer->send($message);

统计信息

  • 总下载量: 23.14k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固