PHPackages                             vemcogroup/laravel-sparkpost-driver - 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. vemcogroup/laravel-sparkpost-driver

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

vemcogroup/laravel-sparkpost-driver
===================================

SparkPost driver to use with Laravel 6.x|7.x|8.x|9.x|10.x

5.2.0(1mo ago)421.7M—1.5%18[2 issues](https://github.com/vemcogroup/laravel-sparkpost-driver/issues)1MITPHPPHP ^8.0.2CI failing

Since Sep 4Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/vemcogroup/laravel-sparkpost-driver)[ Packagist](https://packagist.org/packages/vemcogroup/laravel-sparkpost-driver)[ Docs](https://github.com/vemcogroup/laravel-sparkpost-driver)[ RSS](/packages/vemcogroup-laravel-sparkpost-driver/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (29)Used By (1)

Laravel SparkPost Driver
========================

[](#laravel-sparkpost-driver)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4560d000952d7540c6c7ebbb3aece9ce6998375061cf56340b039b5df444f535/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76656d636f67726f75702f6c61726176656c2d737061726b706f73742d6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vemcogroup/laravel-sparkpost-driver)[![Total Downloads](https://camo.githubusercontent.com/bd2b6e60759eda22b42e3ccc8e707c8ebfc4b74ca25725c5462f508417b7a08e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76656d636f67726f75702f6c61726176656c2d737061726b706f73742d6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vemcogroup/laravel-sparkpost-driver)

Description
-----------

[](#description)

This package allows you to still use SparkPost as MailDriver in Laravel.

This package is inspired by:  and updated with driver from Laravel 5.8.x

Version
-------

[](#version)

Find the correct version to use in the table below:

Laravel versionVersion6.x2.x7.x3.x8.x4.x9.x, 10.x5.xInstallation
------------

[](#installation)

You can install the package via composer:

```
composer require vemcogroup/laravel-sparkpost-driver
```

If you're running an older version of Laravel, make sure you include the version number in your install. For example, for Laravel 8.x:

```
composer require vemcogroup/laravel-sparkpost-driver:4.x
```

The package will automatically register its service provider.

Usage
-----

[](#usage)

You will need to configure your Laravel installation before you can use Sparkpost.

**1. Update config/services.php**

You will need to add Sparkpost service to your `config/services.php`:

```
'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET')
],
```

You can configure additional options there, too:

**Sparkpost API options**

You can define specific \[SparkPost options\] () like `open_tracking`, `click_tracking`, `transactional`

**EU GDPR compliance**

You are able to use the EU endpoint for Europe GDPR compliance by setting the `endpoint` option or the default will be used.

SparkPost (default): `https://api.sparkpost.com/api/v1`SparkPost EU: `https://api.eu.sparkpost.com/api/v1`

**Guzzle options**

You are able to specify [Guzzle options](http://docs.guzzlephp.org/en/stable/request-options.html) in the SparkPost config section `guzzle`.

Just include the additional configuration in your `config/services.php`.

```
'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET'),

    // optional guzzle specific configuration
    'guzzle' => [
        'verify' => true,
        'decode_content' => true,
        ...
    ],
    'options' => [
        // configure endpoint, if not default
        'endpoint' => env('SPARKPOST_ENDPOINT'),

        // optional Sparkpost API options go here
        'return_path' => 'mail@bounces.domain.com',
        'options' => [
            'open_tracking' => false,
            'click_tracking' => false,
            'transactional' => true,
        ],
    ],
],
```

**2. Set API Key**

You will also need to add the SparkPost API Key to your environment (`.env`) file:

```
SPARKPOST_SECRET=__Your_key_here__
```

**3. Set Mail Driver**

You need to set your mail driver to SparkPost.

You can do this by setting the environment variable `MAIL_MAILER` in your `.env` file

```
MAIL_MAILER=sparkpost
```

Or, alternatively by changing the driver in `config/mail.php`:

```
'driver' => env('MAIL_MAILER', 'sparkpost'),
```

> Note: If you are still using Laravel 5, `MAIL_MAILER` will be referenced as `MAIL_DRIVER`.

**4. Update config/mail.php**

Finally, you will also need to add the `sparkpost` driver to the `config/mail.php` mailer section.

```
'mailers' => [
    ...
    'sparkpost' => [
        'transport' => 'sparkpost'
    ],
    ...
],
```

> Note: Laravel 5 already includes this configuration, so you don't need to do it if you're using Laravel 5

Helper functions
----------------

[](#helper-functions)

### Delete supressions

[](#delete-supressions)

```
sparkpost_delete_supression('test@example.com');
```

### Validate single email address

[](#validate-single-email-address)

```
sparkpost_check_email('test@example.com');
```

Mail Subaccounts
----------------

[](#mail-subaccounts)

To send an email using a [SparkPost mail subaccount](https://support.sparkpost.com/docs/user-guide/subaccounts), add the desired subaccount id to the message header before sending:

```
$subaccount_id = 1234;
$this->withSymfonyMessage(function ($message) use ($subaccount_id) { // 'this' is a mailable
    $headers = $message->getHeaders();
    $headers->addTextHeader('subaccount_id', $subaccount_id);
});
```

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance87

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~92 days

Recently: every ~14 days

Total

27

Last Release

59d ago

Major Versions

1.1.0 → 2.0.02019-12-17

2.0.1 → 3.0.02020-03-03

3.0.2 → 4.0.02020-09-09

4.0.4 → 5.0.02021-12-22

PHP version history (4 changes)1.0.0PHP ^7.2

4.0.1PHP ^7.3

4.0.3PHP ^7.3|^8.0

5.0.1PHP ^8.0.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38252305?v=4)[Vemco Group A/S](/maintainers/vemcogroup)[@vemcogroup](https://github.com/vemcogroup)

---

Top Contributors

[![danijelk](https://avatars.githubusercontent.com/u/580753?v=4)](https://github.com/danijelk "danijelk (15 commits)")[![makije](https://avatars.githubusercontent.com/u/1318142?v=4)](https://github.com/makije "makije (7 commits)")[![acurrieclark](https://avatars.githubusercontent.com/u/1306728?v=4)](https://github.com/acurrieclark "acurrieclark (4 commits)")[![sforward](https://avatars.githubusercontent.com/u/3530221?v=4)](https://github.com/sforward "sforward (4 commits)")[![markovic-nikola](https://avatars.githubusercontent.com/u/16388545?v=4)](https://github.com/markovic-nikola "markovic-nikola (3 commits)")[![g0shed](https://avatars.githubusercontent.com/u/4745874?v=4)](https://github.com/g0shed "g0shed (2 commits)")[![JacobBennett](https://avatars.githubusercontent.com/u/1517011?v=4)](https://github.com/JacobBennett "JacobBennett (2 commits)")[![phh](https://avatars.githubusercontent.com/u/1304003?v=4)](https://github.com/phh "phh (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![eldor](https://avatars.githubusercontent.com/u/283184?v=4)](https://github.com/eldor "eldor (1 commits)")[![danielboendergaard](https://avatars.githubusercontent.com/u/314877?v=4)](https://github.com/danielboendergaard "danielboendergaard (1 commits)")[![JohnnyWalkerDigital](https://avatars.githubusercontent.com/u/6763222?v=4)](https://github.com/JohnnyWalkerDigital "JohnnyWalkerDigital (1 commits)")[![jpbalda](https://avatars.githubusercontent.com/u/1484686?v=4)](https://github.com/jpbalda "jpbalda (1 commits)")[![andreasnij](https://avatars.githubusercontent.com/u/1712334?v=4)](https://github.com/andreasnij "andreasnij (1 commits)")[![mostafakram](https://avatars.githubusercontent.com/u/25792357?v=4)](https://github.com/mostafakram "mostafakram (1 commits)")

---

Tags

laravelmailsparkpost

### Embed Badge

![Health badge](/badges/vemcogroup-laravel-sparkpost-driver/health.svg)

```
[![Health](https://phpackages.com/badges/vemcogroup-laravel-sparkpost-driver/health.svg)](https://phpackages.com/packages/vemcogroup-laravel-sparkpost-driver)
```

PHPackages © 2026

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