PHPackages                             kyoushu/inline-swiftmailer-transport - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. kyoushu/inline-swiftmailer-transport

AbandonedLibrary[Mail &amp; Notifications](/categories/mail)

kyoushu/inline-swiftmailer-transport
====================================

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

1.0.0(10y ago)018MITPHPPHP &gt;=5.5

Since Apr 27Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Kyoushu/InlineSwiftmailerTransport)[ Packagist](https://packagist.org/packages/kyoushu/inline-swiftmailer-transport)[ RSS](/packages/kyoushu-inline-swiftmailer-transport/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Kyoushu/InlineSwiftmailerTransport [![Build Status](https://camo.githubusercontent.com/26c1ab56abf77cb5156011f821efda394f9d3e0184978cf50f9b3e50c8a1590d/68747470733a2f2f7472617669732d63692e6f72672f4b796f757368752f496e6c696e6553776966746d61696c65725472616e73706f72742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Kyoushu/InlineSwiftmailerTransport)
========================================================================================================================================================================================================================================================================================================================================================================

[](#kyoushuinlineswiftmailertransport-)

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

Filters
-------

[](#filters)

### Inline Embedded CSS

[](#inline-embedded-css)

This filter is loaded automatically when an instance of InlineTransport is created

#### Example

[](#example)

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

```

Body sent via delivery transport

```
p{ font-weight: bold; }Foo

```

### Inline Included CSS

[](#inline-included-css)

If you want to inline CSS included with &lt;link&gt; elements, rather than CSS which has been embedded with &lt;style&gt; elements, use the InlineCssMessageFilter class.

#### Example

[](#example-1)

```
$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', 'Foo', 'text/html');
$transport->send($message);

```

### Embed Images

[](#embed-images)

#### Example

[](#example-2)

&lt;img&gt; elements with absolute src attributes are embedded, and updated with "cid:########" values.

```
$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', '
