PHPackages                             f500/swiftmailer-sparkpost - 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. f500/swiftmailer-sparkpost

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

f500/swiftmailer-sparkpost
==========================

A SwiftMailer transport implementation for the SparkPost API.

v1.5.0(3y ago)470.8k↓42.7%8[2 issues](https://github.com/f500/swiftmailer-sparkpost/issues)1MITPHP

Since Jan 24Pushed 3y ago2 watchersCompare

[ Source](https://github.com/f500/swiftmailer-sparkpost)[ Packagist](https://packagist.org/packages/f500/swiftmailer-sparkpost)[ RSS](/packages/f500-swiftmailer-sparkpost/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (15)Used By (1)

SwiftMailer SparkPost Transport
===============================

[](#swiftmailer-sparkpost-transport)

[![Build Status](https://camo.githubusercontent.com/2a235310f31cec260abad56f48bfb45010a5347fa6c7a0338b65d09666549dfb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f663530302f73776966746d61696c65722d737061726b706f73742f6261646765732f6275696c642e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/f500/swiftmailer-sparkpost/build-status/develop)[![Code Coverage](https://camo.githubusercontent.com/2ed4dd10a97ae975fa2c334f3da41ef9494f8e41b67e8ae2c269328b3515c1c4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f663530302f73776966746d61696c65722d737061726b706f73742f6261646765732f636f7665726167652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/f500/swiftmailer-sparkpost/?branch=develop)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e97964f6eb0ce9a9d92e1e098f4b50140e5a1eedfefcadc363b0039b79c1ecc0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f663530302f73776966746d61696c65722d737061726b706f73742f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/f500/swiftmailer-sparkpost/?branch=develop)

A [SwiftMailer](http://swiftmailer.org) transport implementation for the [SparkPost API](https://developers.sparkpost.com/api).

It uses the official [SparkPost PHP library](https://github.com/SparkPost/php-sparkpost).

It adds support for some SparkPost specific features to SwiftMailer messages.

Installation
------------

[](#installation)

```
composer require f500/swiftmailer-sparkpost
```

Usage
-----

[](#usage)

```
$transport = SwiftSparkPost\Transport::newInstance('API-KEY');
$mailer    = Swift_Mailer::newInstance($transport);

$message = Swift_Message::newInstance()
    ->setFrom('me@domain.com', 'Me')
    ->setTo(['john@doe.com' => 'John Doe', 'jane@doe.com'])
    ->setSubject('...')
    ->setBody('...');

$sent = $mailer->send($message);
```

### Specialized messages

[](#specialized-messages)

```
$message = SwiftSparkPost\Message::newInstance()
    ->setFrom('me@domain.com', 'Me')
    ->setTo(['john@doe.com' => 'John Doe', 'jane@doe.com'])
    ->setSubject('...')
    ->setBody('...')

    ->setCampaignId('...')
    ->setPerRecipientTags('john@doe.com', ['...'])
    ->setMetadata(['...' => '...'])
    ->setPerRecipientMetadata('john@doe.com', ['...' => '...'])
    ->setSubstitutionData(['...' => '...'])
    ->setPerRecipientSubstitutionData('john@doe.com', ['...' => '...'])
    ->setOptions(['...']);
```

### Configuration

[](#configuration)

```
$config    = SwiftSparkPost\Configuration::newInstance();
$transport = SwiftSparkPost\Transport::newInstance('API-KEY', $config);
$mailer    = Swift_Mailer::newInstance($transport);
```

### Override recipients

[](#override-recipients)

Override all `To`, `Cc` and `Bcc` addresses, but leave name and per-recipient properties intact.

`john@doe.com` becomes `override@domain.com`.

```
$config = SwiftSparkPost\Configuration::newInstance()
    ->setRecipientOverride('override@domain.com');
```

#### Gmail style

[](#gmail-style)

`john@doe.com` becomes `override+john-doe-com@domain.com`.

```
$config = SwiftSparkPost\Configuration::newInstance()
    ->setRecipientOverride('override@domain.com')
    ->setOverrideGmailStyle(true);
```

### Options for all messages

[](#options-for-all-messages)

```
$config = SwiftSparkPost\Configuration::newInstance()
    ->setOptions([
        SwiftSparkPost\Option::TRANSACTIONAL    => false,
        SwiftSparkPost\Option::OPEN_TRACKING    => false,
        SwiftSparkPost\Option::CLICK_TRACKING   => false,
        SwiftSparkPost\Option::SANDBOX          => true,
        SwiftSparkPost\Option::SKIP_SUPPRESSION => true,
        SwiftSparkPost\Option::INLINE_CSS       => true,
        SwiftSparkPost\Option::IP_POOL          => 'some-ip-pool',
    ]);
```

These options are also available for messages, where they take precedence over the configured options.

```
$message = SwiftSparkPost\Message::newInstance()
    ->setOptions(['...']);
```

### IP pool probability

[](#ip-pool-probability)

Add a probability factor to enable the IP pool only for a percentage of messages sent. 0 will never use the IP pool, 1 will always use it.

Can be used to facilitate an IP warming process.

```
$config = SwiftSparkPost\Configuration::newInstance()
    ->setOptions([SwiftSparkPost\Option::IP_POOL => 'some-ip-pool'])
    ->setIpPoolProbability(0.5);
```

License
-------

[](#license)

[Copyright 2017 Future500 B.V.](https://github.com/f500/swiftmailer-sparkpost/blob/master/LICENSE)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 88.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~156 days

Recently: every ~505 days

Total

14

Last Release

1365d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d19aec04a4ae29ebcc0648296c8152404f86c0573d6eb5d2b592335c704b3a78?d=identicon)[f500](/maintainers/f500)

---

Top Contributors

[![jaspernbrouwer](https://avatars.githubusercontent.com/u/738933?v=4)](https://github.com/jaspernbrouwer "jaspernbrouwer (70 commits)")[![thewunder](https://avatars.githubusercontent.com/u/1265740?v=4)](https://github.com/thewunder "thewunder (6 commits)")[![mjmeijerman](https://avatars.githubusercontent.com/u/12456874?v=4)](https://github.com/mjmeijerman "mjmeijerman (2 commits)")[![ovrflo](https://avatars.githubusercontent.com/u/4866936?v=4)](https://github.com/ovrflo "ovrflo (1 commits)")

---

Tags

apimailmailertransportsparkpostswiftmailer

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/f500-swiftmailer-sparkpost/health.svg)

```
[![Health](https://phpackages.com/badges/f500-swiftmailer-sparkpost/health.svg)](https://phpackages.com/packages/f500-swiftmailer-sparkpost)
```

###  Alternatives

[yuan1994/tp-mailer

A powerful and beautiful php mailer for All of ThinkPHP and Other PHP Frameworks based SwiftMailer

812.0k1](/packages/yuan1994-tp-mailer)[scullwm/mailhookbundle

A bundle to catch API webhook from differents mail service

4020.5k](/packages/scullwm-mailhookbundle)[cattong/think-mailer

A powerful and beautiful php mailer for All of ThinkPHP and Other PHP Frameworks based SwiftMailer

361.9k1](/packages/cattong-think-mailer)[yarcode/yii2-mailgun-mailer

Mailgun mailer implementation for Yii2

1576.0k](/packages/yarcode-yii2-mailgun-mailer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
