PHPackages                             narendravaghela/cakephp-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. narendravaghela/cakephp-sparkpost

ActiveCakephp-plugin[Mail &amp; Notifications](/categories/mail)

narendravaghela/cakephp-sparkpost
=================================

SparkPostEmail plugin for CakePHP

27PHP

Since Oct 20Pushed 9y ago3 watchersCompare

[ Source](https://github.com/narendravaghela/cakephp-sparkpost)[ Packagist](https://packagist.org/packages/narendravaghela/cakephp-sparkpost)[ RSS](/packages/narendravaghela-cakephp-sparkpost/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

SparkPost plugin for CakePHP
============================

[](#sparkpost-plugin-for-cakephp)

[![Build Status](https://camo.githubusercontent.com/a13c0c81efaa643ef1af11bbd02d5d71daa057cb66224cbd0920cd025aa85c61/68747470733a2f2f7472617669732d63692e6f72672f6e6172656e64726176616768656c612f63616b657068702d737061726b706f73742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/narendravaghela/cakephp-sparkpost)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

This plugin provides email delivery using [SparkPost](https://www.sparkpost.com/).

Requirements
------------

[](#requirements)

This plugin has the following requirements:

- CakePHP 3.0.0 or greater.
- PHP 5.4.16 or greater.

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

```
composer require narendravaghela/cakephp-sparkpost

```

After installation, [Load the plugin](http://book.cakephp.org/3.0/en/plugins.html#loading-a-plugin)

```
Plugin::load('SparkPostEmail');
```

Or, you can load the plugin using the shell command

```
$ bin/cake plugin load SparkPostEmail
```

Setup
-----

[](#setup)

Set your SparkPost credentials in `EmailTransport` settings in app.php

```
'EmailTransport' => [
...
  'sparkpost' => [
      'className' => 'SparkPostEmail.SparkPost',
      'apiKey' => '123456789123456789' // your api key
  ]
]
```

And create new delivery profile for sparkpost in `Email` settings.

```
'Email' => [
    'default' => [
        'transport' => 'default',
        'from' => 'you@localhost',
        //'charset' => 'utf-8',
        //'headerCharset' => 'utf-8',
    ],
    'sparkpost' => [
        'transport' => 'sparkpost'
    ]
]
```

Usage
-----

[](#usage)

You can now simply use the CakePHP `Email` to send an email via SparkPost.

```
$email = new Email('sparkpost');
$result = $email->from(['foo@example.com' => 'Example Site'])
  ->to('bar@example.com')
  ->subject('Welcome to CakePHP')
  ->template('welcome')
  ->viewVars(['foo' => 'Bar'])
  ->emailFormat('both')
  ->attachments([
      'cake_icon1.png' => Configure::read('App.imageBaseUrl') . 'cake.icon.png',
      'cake_icon2.png' => ['file' => Configure::read('App.imageBaseUrl') . 'cake.icon.png'],
      WWW_ROOT . 'favicon.ico'
  ])
  ->send('Your email content here');
```

You can also set custom headers using `ch:` prefix.

```
$email = new Email('sparkpost');
$result = $email->from(['foo@example.com' => 'Example Site'])
  ->to('bar@example.com')
  ->addHeaders(['ch:My-Custom-Header' => 'Awesome header string'])
  ->addHeaders(['ch:Another-Custom-Header' => 'Awesome header string'])
  ->emailFormat('both')
  ->attachments([
      'cake_icon1.png' => Configure::read('App.imageBaseUrl') . 'cake.icon.png',
      'cake_icon2.png' => ['file' => Configure::read('App.imageBaseUrl') . 'cake.icon.png'],
      WWW_ROOT . 'favicon.ico'
  ])
  ->send('Your email content here');
```

You can set other custom parameters which SparkPost supports using `co:` prefix.

```
$email = new Email('sparkpost');
$result = $email->from(['foo@example.com' => 'Example Site'])
  ->to('bar@example.com')
  ->emailFormat('both')
  ->addHeaders(['ch:My-Custom-Header' => 'Awesome header string'])
  ->addHeaders(['co:open_tracking' => true])
  ->addHeaders(['co:click_tracking' => true])
  ->addHeaders(['co:transactional' => true])
  ->addHeaders(['co:metadata' => ['meta1' => 'value1', 'meta2' => 'value2']])
  ->send('Your email content here');
```

That is it.

Reporting Issues
----------------

[](#reporting-issues)

If you have a problem with this plugin or any bug, please open an issue on [GitHub](https://github.com/narendravaghela/cakephp-sparkpost/issues).

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1432986?v=4)[Narendra Vaghela](/maintainers/narendravaghela)[@narendravaghela](https://github.com/narendravaghela)

---

Top Contributors

[![narendravaghela](https://avatars.githubusercontent.com/u/1432986?v=4)](https://github.com/narendravaghela "narendravaghela (10 commits)")

### Embed Badge

![Health badge](/badges/narendravaghela-cakephp-sparkpost/health.svg)

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

###  Alternatives

[mattketmo/email-checker

Throwaway email detection library

2752.1M5](/packages/mattketmo-email-checker)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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