PHPackages                             sprintcube/cakephp-elastic-email - 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. sprintcube/cakephp-elastic-email

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

sprintcube/cakephp-elastic-email
================================

ElasticEmail plugin for CakePHP 3 - Send transactional emails using Elastic Email API

v1.0.2(7y ago)499[2 issues](https://github.com/sprintcube/cakephp-elastic-email/issues)MITPHPPHP &gt;=5.6.0

Since Jul 3Pushed 7y ago2 watchersCompare

[ Source](https://github.com/sprintcube/cakephp-elastic-email)[ Packagist](https://packagist.org/packages/sprintcube/cakephp-elastic-email)[ RSS](/packages/sprintcube-cakephp-elastic-email/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Elastic Email Plugin for CakePHP 3
==================================

[](#elastic-email-plugin-for-cakephp-3)

[![Build Status](https://camo.githubusercontent.com/d009f7661ec158bcd683bbc8a42c2bc0c208fd153d2da1e4764aa4852874a70b/68747470733a2f2f7472617669732d63692e6f72672f737072696e74637562652f63616b657068702d656c61737469632d656d61696c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sprintcube/cakephp-elastic-email)[![codecov](https://camo.githubusercontent.com/91da1be35e42f501d293480c7dd59732b26c975b0d9966e4cf2e9991dec72e37/68747470733a2f2f636f6465636f762e696f2f67682f737072696e74637562652f63616b657068702d656c61737469632d656d61696c2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/sprintcube/cakephp-elastic-email)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/f5eec1819982532e50bd826194c060ddb1f24ae7845577e8103df394633155ba/68747470733a2f2f706f7365722e707567782e6f72672f737072696e74637562652f63616b657068702d656c61737469632d656d61696c2f762f737461626c65)](https://packagist.org/packages/sprintcube/cakephp-elastic-email)[![Total Downloads](https://camo.githubusercontent.com/072194d467eccfd3a9079fd3d3075c51dde7fd26082cd27ce312ce0661008de4/68747470733a2f2f706f7365722e707567782e6f72672f737072696e74637562652f63616b657068702d656c61737469632d656d61696c2f646f776e6c6f616473)](https://packagist.org/packages/sprintcube/cakephp-elastic-email)

This plugin provides email delivery using [Elastic Email](https://elasticemail.com/).

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

[](#requirements)

This plugin has the following requirements:

- CakePHP 3.4.0 or greater.
- PHP 5.6 or greater.

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

[](#installation)

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

```
composer require sprintcube/cakephp-elastic-email

```

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

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

Or, you can load the plugin using the shell command

```
$ bin/cake plugin load ElasticEmail
```

Setup
-----

[](#setup)

Set your Elastic Email Api key in `EmailTransport` settings in app.php

```
'EmailTransport' => [
...
  'elasticemail' => [
      'className' => 'ElasticEmail.ElasticEmail',
      'apiKey' => 'your-api-key' // your api key
  ]
]
```

If you face an SSL certificate error, please follow below steps:

1. Open
2. Copy the entire page and save it as a "cacert.pem"
3. Open your php.ini file and insert or update the following line: curl.cainfo = "\[pathtofile\]\\cacert.pem"

And create new delivery profile in `Email` settings.

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

Usage
-----

[](#usage)

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

```
$email = new Email('elasticemail');

$email->setFrom(['you@yourdomain.com' => 'CakePHP Elastic Email'])
    ->setSender('someone@example.com', 'Someone')
    ->setTo('foo@example.com.com')
    ->addTo('bar@example.com')
    ->setHeaders(['X-Custom' => 'headervalue'])
    ->setSubject('Email from CakePHP Elastic Email plugin')
    ->send('Message from CakePHP Elastic Email plugin');
```

That is it.

Advance Use
-----------

[](#advance-use)

You can also use few more options to send email via Elastic Email APIs. To do so, get the transport instance and call the appropriate methods before sending the email.

### Transactional Email

[](#transactional-email)

You can mark the email as `transactional` email.

```
$email = new Email('elasticemail');
$emailInstance = $email->getTransport();
$emailInstance->isTransactional(true);
$email->send();
```

### Custom Headers

[](#custom-headers)

You can pass your own headers. It must be prefixed with "X-". Use the default `Email::setHeaders` method like,

```
$email = new Email('elasticemail');

$email->setFrom(['you@yourdomain.com' => 'CakePHP Elastic Email'])
    ->setSender('someone@example.com', 'Someone')
    ->setTo('foo@example.com.com')
    ->addTo('bar@example.com')
    ->setHeaders([
        'X-Custom' => 'headervalue',
        'X-MyHeader' => 'myvalue'
    ])
    ->setSubject('Email from CakePHP Elastic Email plugin')
    ->send('Message from CakePHP Elastic Email plugin');
```

> Make sure you have enabled custom header from your Elastic Email settings.

### Attachments

[](#attachments)

Set your attachments using `Email::setAttachments` method.

```
$email = new Email('elasticemail');

$email->setFrom(['you@yourdomain.com' => 'CakePHP Elastic Email'])
    ->setSender('someone@example.com', 'Someone')
    ->setTo('foo@example.com.com')
    ->addTo('bar@example.com')
    ->setAttachments([
        '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'
    ])
    ->setSubject('Email from CakePHP Elastic Email plugin')
    ->send('Message from CakePHP Elastic Email plugin');
```

> You need to have some credit in your account to send attachments. Otherwise you will get `Not enough credit for campaign.` error.

### Template

[](#template)

You can use the template created in Elastic Email backend. Get the template id by either using their API or from the URL. Set the template id using `setTemplate` method.

```
$email = new Email('elasticemail');
$emailInstance = $email->getTransport();
$emailInstance->setTemplte(123);
$email->send();
```

### Template Variables

[](#template-variables)

Elastic Email provides a nice way to replace the template content using template variables. You can use variables like {firstname}, {lastname} in your template and pass their replacement value.

```
$mergeVars = [
    'firstname' => 'Foo',
    'lastname' => 'Bar',
    'title' => 'Good Title'
];

$email = new Email('elasticemail');
$emailInstance = $email->getTransport();
$emailInstance->setMergeVariables($mergeVars);

$email->setFrom(['from@example.com' => 'CakePHP Elastic Email'])
    ->setTo('to@example.com')
    ->setEmailFormat('both')
    ->setSubject('{title} - Email from CakePHP Elastic Email plugin')
    ->send('Hello {firstname} {lastname},  This is an email from CakePHP Elastic Email plugin.');
```

### Schedule

[](#schedule)

You can schedule the email to be sent in future date. You can set upto 1 year in future i.e. 524160 minutes.

```
$email = new Email('elasticemail');
$emailInstance = $email->getTransport();
$emailInstance->setScheduleTime(60); // after 1 hour from sending time
$email->send();
```

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

[](#reporting-issues)

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

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~24 days

Total

3

Last Release

2871d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

cakephpcakephp-pluginelasticemailemailphpemailcakephpelasticemail

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sprintcube-cakephp-elastic-email/health.svg)

```
[![Health](https://phpackages.com/badges/sprintcube-cakephp-elastic-email/health.svg)](https://phpackages.com/packages/sprintcube-cakephp-elastic-email)
```

###  Alternatives

[narendravaghela/cakephp-mailgun

Mailgun plugin for CakePHP - Send emails using Mailgun API

23364.0k](/packages/narendravaghela-cakephp-mailgun)[slm/mail

Integration of various email service providers in the Laminas\\Mail

108741.5k1](/packages/slm-mail)[lorenzo/cakephp-email-queue

Queue, preview and and send emails stored in the database

57122.3k2](/packages/lorenzo-cakephp-email-queue)[dereuromark/cakephp-setup

A CakePHP plugin containing lots of useful management tools

35184.7k2](/packages/dereuromark-cakephp-setup)[elastic-email/web-api-client

Easily send emails with Elastic Email using Web API PHP Client https://elasticemail.com/

22350.8k2](/packages/elastic-email-web-api-client)[gourmet/email

Gourmet Email Plugin for rapid CakePHP application development.

175.2k](/packages/gourmet-email)

PHPackages © 2026

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