2017 © Pedro Peláez
 

library inline-swiftmailer-transport

A SwiftMailer transport which inlines CSS before forwarding the message to another transport for delivery

image

kyoushu/inline-swiftmailer-transport

A SwiftMailer transport which inlines CSS before forwarding the message to another transport for delivery

  • Thursday, April 28, 2016
  • by Kyoushu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Kyoushu/InlineSwiftmailerTransport Build Status

A SwiftMailer transport which inlines CSS before forwarding the message to another transport for delivery, (*1)

Filters

Inline Embedded CSS

This filter is loaded automatically when an instance of InlineTransport is created, (*2)

Example

$deliveryTransport = new \Swift_SmtpTransport('localhost', 25);
$transport = new InlineTransport($deliveryTransport, new \Swift_Events_SimpleEventDispatcher());
$message = new \Swift_Message('Foo', '<html><head><style>p{ font-weight: bold; }</style></head><body><p>Foo</p></body></html>', 'text/html');
$transport->send($message);

Body sent via delivery transport, (*3)

<html><head><style>p{ font-weight: bold; }</style></head><body><p style="font-weight: bold;">Foo</p></body></html>

Inline Included CSS

If you want to inline CSS included with <link> elements, rather than CSS which has been embedded with <style> elements, use the InlineCssMessageFilter class., (*4)

Example

$webRootDir = '/path/to/my/web/root/dir';

$deliveryTransport = new \Swift_SmtpTransport('localhost', 25);
$transport = new InlineTransport($deliveryTransport, new \Swift_Events_SimpleEventDispatcher());
$transport->addMessageFilter(new InlineCssMessageFilter($webRootDir));

$message = new \Swift_Message('Foo', '<html><head><link rel="stylesheet" href="/css/email.css"></head><body><p>Foo</p></body></html>', 'text/html');
$transport->send($message);

Embed Images

Example

<img> elements with absolute src attributes are embedded, and updated with "cid:########" values., (*5)

$webRootDir = '/path/to/my/web/root/dir';

$deliveryTransport = new \Swift_SmtpTransport('localhost', 25);
$transport = new InlineTransport($deliveryTransport, new \Swift_Events_SimpleEventDispatcher());
$transport->addMessageFilter(new EmbedImageMessageFilter($webRootDir));

$message = new \Swift_Message('Foo', '<html><body><img src="/images/my-image.png"</body></html>', 'text/html');
$transport->send($message);

Body sent via delivery transport, (*6)

<html><body><img src="cid:09F48ag2b674"</body></html>

The Versions

28/04 2016

dev-master

9999999-dev

A SwiftMailer transport which inlines CSS before forwarding the message to another transport for delivery

  Sources   Download

MIT

The Requires

 

The Development Requires

by James Willans

27/04 2016

1.0.0

1.0.0.0

A SwiftMailer transport which inlines CSS before forwarding the message to another transport for delivery

  Sources   Download

MIT

The Requires

 

The Development Requires

by James Willans