PHPackages                             locomotivemtl/charcoal-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. locomotivemtl/charcoal-email

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

locomotivemtl/charcoal-email
============================

Email sending and queueing for Charcoal

0.7.2.1(4y ago)014.2k3MITPHPPHP &gt;=7.1CI failing

Since May 19Pushed 4y ago11 watchersCompare

[ Source](https://github.com/locomotivemtl/charcoal-email)[ Packagist](https://packagist.org/packages/locomotivemtl/charcoal-email)[ Docs](https://charcoal.locomotive.ca)[ RSS](/packages/locomotivemtl-charcoal-email/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (12)Versions (32)Used By (3)

Charcoal Email
==============

[](#charcoal-email)

Sending emails (with *PHPMailer*) and queue management.

How to install
==============

[](#how-to-install)

The preferred (and only supported) way of installing *charcoal-email* is with **composer**:

```
★ composer require locomotivemtl/charcoal-email
```

Dependencies
------------

[](#dependencies)

- [`PHP 5.6+`](http://php.net)
    - PHP 7.3+ is highly recommended
- [`phpmailer/phpmailer`](https://github.com/PHPMailer/PHPMailer)
- [`locomotivemtl/charcoal-config`](https://github.com/locomotivemtl/charcoal-config)
- [`locomotivemtl/charcoal-app`](https://github.com/locomotivemtl/charcoal-app)

Optional dependencies
---------------------

[](#optional-dependencies)

- [`pimple/pimple`](http://pimple.sensiolabs.org/)
    - Dependency injection Container (required for the [Service Provider](#service-provider))

> 👉 All optional depedencies are required for development. All other development dependencies, which are optional when using charcoal-email in a project, are described in the [Development](#development) section of this README file.

Usage
=====

[](#usage)

```
$email = $container['email'];
$email->setData([
    'campaign' => 'Campaign identifier'
    'to' => [
        'recipient@example.com',
        '"Some guy" ',
        [
            'name'  => 'Other guy',
            'email' => 'otherguy@example.com'
        ]
    ],
    'bcc' => 'shadow@example.com'
    'from' => '"Company inc." ',
    'reply_to' => [
        'name' => 'Jack CEO',
        'email' => 'jack@example.com'
    ],
    'subject' => $this->translator->trans('Email subject'),
    'template_ident' => 'foo/email/default-email'
    'attachments' => [
        'foo/bar.pdf',
        'foo/baz.pdf'
    ]
]);
$email->send();

// Alternately, to send at a later date / use the queue system:
$email->queue('in 5 minutes');
```

Email Config
============

[](#email-config)

The entire email system can be configured from the main app config, in the `email` config key.

```
{
    "email": {
        "smtp": true,
        "smtp_hostname": "smtp.example.com",
        "smtp_port": 25,
        "smtp_security": "tls",
        "smtp_username": "user@example.com",
        "smtp_password": "password",

        "default_from": "webproject@example.com",
        "default_reply_to": "webproject@example.com",
        "default_track": false,
        "default_log": true
    }
}
```

Service Provider
================

[](#service-provider)

All email services can be quickly registered to a (`pimple`) container with `\Charcoal\Email\ServiceProvider\EmailServiceProvider`.

**Provided services:**

ServiceTypeDescription**email**`Email`1An email object (factory).**email/factory**`FactoryInterface`2An email factory, to create email objects.1 `\Charcoal\Email\Email`.
2 `Charcoal\Factory\FactoryInterface`.

Also available are the following helpers:

Helper ServiceTypeDescription**email/config**`EmailConfig`3Email configuration.**email/view**`ViewInterface`4The view object to render email templates (`$container['view']`).3 `\Charcoal\Email\EmailConfig`.
4 `\Charcoal\View\ViewInterface`.

> 👉 For charcoal projects, simply add this provider to your config to enable:
>
> ```
> {
>   "service_providers": {
>       "charcoal/email/service-provider/email": {}
>   }
> }
> ```

Service dependencies
--------------------

[](#service-dependencies)

For the *email* service provider to work properly, the following services are expected to e registerd on the same container:

- `config`
- `view`

Development
===========

[](#development)

To install the development environment:

```
★ composer install --prefer-source
```

To run the scripts (phplint, phpcs and phpunit):

```
★ composer test
```

Development dependencies
------------------------

[](#development-dependencies)

- `phpunit/phpunit`
- `squizlabs/php_codesniffer`
- `satooshi/php-coveralls`

Continuous Integration
----------------------

[](#continuous-integration)

ServiceBadgeDescription[Travis](https://travis-ci.org/locomotivemtl/charcoal-email)[![Build Status](https://camo.githubusercontent.com/e80bab459d3222860056906cd4428cea840b3eef1f2bc9becb5356c35a240c50/68747470733a2f2f7472617669732d63692e6f72672f6c6f636f6d6f746976656d746c2f63686172636f616c2d656d61696c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/locomotivemtl/charcoal-email)Runs code sniff check and unit tests. Auto-generates API documentation.[Scrutinizer](https://scrutinizer-ci.com/g/locomotivemtl/charcoal-email/)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f71dff7f3c82a9daaeba10d685c1738a53246b5ccd62dbc46c997d6573078749/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6f636f6d6f746976656d746c2f63686172636f616c2d656d61696c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/locomotivemtl/charcoal-email/?branch=master)Code quality checker. Also validates API documentation quality.[Coveralls](https://coveralls.io/github/locomotivemtl/charcoal-email)[![Coverage Status](https://camo.githubusercontent.com/b017e42fbff731bd53ea6a75e82c77d786bfef610724094b1811d24c88954709/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6c6f636f6d6f746976656d746c2f63686172636f616c2d656d61696c2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/locomotivemtl/charcoal-email?branch=master)Unit Tests code coverage.[Sensiolabs](https://insight.sensiolabs.com/projects/54058388-3b5d-47e3-8185-f001232d31f7)[![SensioLabsInsight](https://camo.githubusercontent.com/406616acfe445d086b8ebb608a71df51625856d630b85780dff9322414e71a19/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35343035383338382d336235642d343765332d383138352d6630303132333264333166372f6d696e692e706e67)](https://insight.sensiolabs.com/projects/54058388-3b5d-47e3-8185-f001232d31f7)Another code quality checker, focused on PHP.Coding Style
------------

[](#coding-style)

The Charcoal-Email module follows the Charcoal coding-style:

- [*PSR-1*](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
- [*PSR-2*](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
- [*PSR-4*](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md), autoloading is therefore provided by *Composer*.
- [*phpDocumentor*](http://phpdoc.org/) comments.
- Read the [phpcs.xml](phpcs.xml) file for all the details on code style.

> Coding style validation / enforcement can be performed with `composer phpcs`. An auto-fixer is also available with `composer phpcbf`.

Authors
=======

[](#authors)

- [Locomotive](https://locomotive.ca)

License
=======

[](#license)

Charcoal is licensed under the MIT license. See [LICENSE](LICENSE) for details.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.9% 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 ~70 days

Recently: every ~113 days

Total

30

Last Release

1615d ago

PHP version history (3 changes)0.1PHP &gt;=5.5.0

0.1.3PHP &gt;=5.6.0

0.6PHP &gt;=7.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/0a4f39523b4b2837562ba0848a0327b8d340118d1ba87cb0f5d59b1d5cb6beba?d=identicon)[mcaskill](/maintainers/mcaskill)

---

Top Contributors

[![mducharme](https://avatars.githubusercontent.com/u/12157?v=4)](https://github.com/mducharme "mducharme (82 commits)")[![JoelAlphonso](https://avatars.githubusercontent.com/u/10762266?v=4)](https://github.com/JoelAlphonso "JoelAlphonso (28 commits)")[![mcaskill](https://avatars.githubusercontent.com/u/29353?v=4)](https://github.com/mcaskill "mcaskill (27 commits)")[![BeneRoch](https://avatars.githubusercontent.com/u/3017380?v=4)](https://github.com/BeneRoch "BeneRoch (9 commits)")[![dominiclord](https://avatars.githubusercontent.com/u/1775204?v=4)](https://github.com/dominiclord "dominiclord (4 commits)")[![veve40](https://avatars.githubusercontent.com/u/7537381?v=4)](https://github.com/veve40 "veve40 (3 commits)")[![losted](https://avatars.githubusercontent.com/u/165665?v=4)](https://github.com/losted "losted (1 commits)")[![pascalrioux](https://avatars.githubusercontent.com/u/36555872?v=4)](https://github.com/pascalrioux "pascalrioux (1 commits)")

---

Tags

emailqueuecharcoalphpmailer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/locomotivemtl-charcoal-email/health.svg)

```
[![Health](https://phpackages.com/badges/locomotivemtl-charcoal-email/health.svg)](https://phpackages.com/packages/locomotivemtl-charcoal-email)
```

###  Alternatives

[zbateson/mail-mime-parser

MIME email message parser

54149.2M79](/packages/zbateson-mail-mime-parser)[rmrevin/yii2-postman

Mail module for Yii2.

2612.3k](/packages/rmrevin-yii2-postman)[nterms/yii2-mailqueue

Email queue component for yii2 that works with yii2-swiftmailer.

87129.2k2](/packages/nterms-yii2-mailqueue)[lorenzo/cakephp-email-queue

Queue, preview and and send emails stored in the database

57121.5k1](/packages/lorenzo-cakephp-email-queue)[itinerisltd/wp-phpmailer

WP PHPMailer provides a clean and simple way to configure WordPress-bundled PHPMailer library, allowing you to quickly get started sending mail through a local or cloud based service of your choice.

6231.6k](/packages/itinerisltd-wp-phpmailer)[tigrov/yii2-mailqueue

Yii2 mail queue component for yii2-swiftmailer.

186.1k](/packages/tigrov-yii2-mailqueue)

PHPackages © 2026

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