PHPackages                             thinker-g/yii2-hermes-mailing - 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. thinker-g/yii2-hermes-mailing

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

thinker-g/yii2-hermes-mailing
=============================

Highly configurable multi-process emailing solution (console command) for yii2.0.

v1.0.0(11y ago)181259MITPHP

Since May 8Pushed 9y ago5 watchersCompare

[ Source](https://github.com/thinker-g/yii2-hermes-mailing)[ Packagist](https://packagist.org/packages/thinker-g/yii2-hermes-mailing)[ RSS](/packages/thinker-g-yii2-hermes-mailing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Hermes Emailing \[v1.0.0\]
==========================

[](#hermes-emailing-v100)

Highly configurable multi-process emailing solution (console command) for yii2.0.

[![Latest Stable Version](https://camo.githubusercontent.com/fea7ca57ba9d6949c99d5f7a28ec43cdb2446dcbb94750f3d3b38e774f8e31f1/68747470733a2f2f706f7365722e707567782e6f72672f7468696e6b65722d672f796969322d6865726d65732d6d61696c696e672f762f737461626c65)](https://packagist.org/packages/thinker-g/yii2-hermes-mailing)[![Total Downloads](https://camo.githubusercontent.com/cf9639ef2140b24638907d4aa11bbc1ce7116fa9641eeac78523654035b9656a/68747470733a2f2f706f7365722e707567782e6f72672f7468696e6b65722d672f796969322d6865726d65732d6d61696c696e672f646f776e6c6f616473)](https://packagist.org/packages/thinker-g/yii2-hermes-mailing)[![License](https://camo.githubusercontent.com/215b738e7c2fe2f5c2d13b9d0b1d7ea66876dfbb2fcb4f44cbaa3d95a0561600/68747470733a2f2f706f7365722e707567782e6f72672f7468696e6b65722d672f796969322d6865726d65732d6d61696c696e672f6c6963656e7365)](https://packagist.org/packages/thinker-g/yii2-hermes-mailing)[![Powered by Yii 2.0](https://camo.githubusercontent.com/b8a68cccd6fea52a7960e56a65e28aa53a10928b4ef965ded3aeb3d3cf1a9b5e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f776572656425323062792d5969692532304672616d65776f726b253230322e302d79656c6c6f77677265656e2e737667)](http://www.yiiframework.com/)

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

[](#installation)

### 1. Downloading

[](#1-downloading)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist thinker-g/yii2-hermes-mailing:dev-master
```

or add

```
"thinker-g/yii2-hermes-mailing": "dev-master"
```

to the require section of your `composer.json` file.

You could also download a copy directly from the [GitHub project page](http://github.com/thinker-g/yii2-hermes-mailing). If you do in this way, you'll be needing to setup the directory of alias `@thinker_g/HermesMailing`. Here's an example.

In config/main.php, assume that you put `yii2-hermes-mailing` folder in `extensions/` of your project:

```
return [
    'id' => 'app-console',
    ...
    'aliases' => [
        '@thinker_g/HermesMailing' => '@app/extensions/yii2-hermes-mailing',
        ...
    ],
    ...
];
```

In the example `@app` is the app's root alias, which will be replaced by its real path. It could be '@common', '@frontend', '@backend' in an advanced template.

### 2. Installing

[](#2-installing)

#### a) Configuring

[](#a-configuring)

Edit the configuration file of your console appliction ( `console/config/main.php` / `config/console.php` by default) to mount the console command controller.

```
return [
    'id' => 'app-console',
    ...
    'controllerMap' => [
        'email' => [
            'class' => 'thinker_g\HermesMailing\console\DefaultController',
            'modelClass' => 'common\models\HermesMail',
            'installerMode' => true,
            'testMode' => true
        ],
        ...
    ],
    ...
];
```

Please be noticed that `modelClass` will be used by the command later to generate the AR model, its default value is `app\\models\\HermesMail`. If you are using a basic yii2.0 template or just want to keep the model in model directory of the console application, you don't need to specify the `modelClass`. Here we assume that we are using the default advanced yii2.0 template. And of course, you can specify any model name as you want.

Set `installerMode` to **true** will enable some helper actions that will only be used during installation. And it should be set to **false** (or be removed as **false** is default) when the command is ready for real usage.

`testMode` is a helper option for testing performace and adjusting parameters. When it's enabled, the real "send" operation will randomly return **true** or **false**. Except this, all other operations will be performed normally.

#### b) Initializing (creating database table and generating AR model)

[](#b-initializing-creating-database-table-and-generating-ar-model)

Be sure that your 'db' application component is functioning, then we can issue the command below to initialize the command. The default initialization will create a table named `hermes_mail` and its corresponding AR model with the name you specifed above.

```
user@localhost:~/ws/advanced$ ./yii email/install
```

You should be seeing this if the command is installed successfully and ready for using.

```
user@localhost:~/ws/advanced$ ./yii email/install
Create table hermes_mail? (yes|no) [no]:y
Migrating database...
    > create table hermes_mail ... done (time: 0.065s)
Running 'Model Generator'...

The following files will be generated:
        [new] /home/admin/ws/advanced/common/models/HermesMail.php

Ready to generate the selected files? (yes|no) [yes]:y

Files were generated successfully!
Generating code using template "/home/admin/ws/advanced/vendor/yiisoft/yii2-gii/generators/
model/default"...
 generated /home/admin/ws/advanced/common/models/HermesMail.php
done!

Install complete!
user@localhost:~/ws/advanced$
```

#### c) Fill up some test data

[](#c-fill-up-some-test-data)

Up to now your program is ready. You could use the generated AR model anywhere in your code, to insert emails to the queue. To facilitate testing, you could use `email/fill4test` command to prepare(insert) 1000 emails for test.

```
user@localhost:~/ws/advanced$ ./yii help email/fill4test

DESCRIPTION

Run to insert a certain number of test email entries.

USAGE

yii email/fill4test [insertCount] [from] [to] [...options...]

- insertCount: int (defaults to 1000)
  Number of emails to insert.

- from: string (defaults to 'from_{seq}@example.com')
  From address where the token "{seq}" will be replaced by the sequence number.

- to: string (defaults to 'to_{seq}@example.com')
  To address where the token "{seq}" will be replaced by the sequence number.
```

Let's say we want 500 emails to give a try:

```
user@localhost:~/ws/advanced$ ./yii email/fill4test 500
An example email has been appended to the email queue. ID: 1.
An example email has been appended to the email queue. ID: 2.
...
An example email has been appended to the email queue. ID: 500.
===================================================================== 100%
500 mails inserted.
```

Now let's move on to run something real.

Usage
-----

[](#usage)

### Check before taking off:

[](#check-before-taking-off)

\*\*\* ATTENTION! Please check following items before you run the test. This will ensure your emails inserted above won't be sent out. \*\*\*

- InstallerMode is off. (`installerMode` =&gt; false)
- Test mode is on. (`testMode` =&gt; true)
- Your "mailer" application component is functioning.

Once the extension is installed, simply use it in your code by :

```
user@localhost:~/ws/advanced$ ./yii email/send-queue
[2015-03-20 09:54:49] Emailing process (server id: 0) started.
[2015-03-20 09:54:49] Signed 100 entries with signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:54:52] 100 emails processed by signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:54:52] Signed 100 entries with signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:54:55] 100 emails processed by signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:54:55] Signed 100 entries with signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:54:57] 100 emails processed by signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:54:57] Signed 100 entries with signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:55:01] 100 emails processed by signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:55:01] Signed 100 entries with signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:55:04] 100 emails processed by signature: 89f0bc811b35b23e888674875a630e42.
[2015-03-20 09:55:04] Emailing process (server id: 0) stopped.
user@localhost:~/ws/advanced$
```

If you are seeing some output like this, your command is working. And you can deploy it by configuring your crontab.

### CRONTAB

[](#crontab)

Please do not forget to disable `testMode` before you setup crontab for real emailing. Here's an example of crontab seeting for webmaster user.

```
 ================== hermes mailing ==================
 * * * * * sleep  0;/home/webmaster/yii2Adv/yii email/send-queue >> /home/webmaster/yii2adv/console/logs/send-queue-0
 * * * * * sleep 10;/home/webmaster/yii2Adv/yii email/send-queue >> /home/webmaster/yii2adv/console/logs/send-queue-1
 * * * * * sleep 20;/home/webmaster/yii2Adv/yii email/send-queue >> /home/webmaster/yii2adv/console/logs/send-queue-2
 * * * * * sleep 30;/home/webmaster/yii2Adv/yii email/send-queue >> /home/webmaster/yii2adv/console/logs/send-queue-3
 * * * * * sleep 40;/home/webmaster/yii2Adv/yii email/send-queue >> /home/webmaster/yii2adv/console/logs/send-queue-4
 * * * * * sleep 50;/home/webmaster/yii2Adv/yii email/send-queue >> /home/webmaster/yii2adv/console/logs/send-queue-5
 ================== hermes mailing ==================
```

This setting will start a new emailing process every 10 seconds, every process will work parallely till all mails are sent in the queue.

Advanced Configuration
----------------------

[](#advanced-configuration)

*Under development, coming soon!*

This part will cover a batch of interesting features:

- Sending control (Indirect control of memory consumption and execution time.)
- Distributed deployment
- Using dedicated email database service
- Complying spamming rules
- Customization (replacing mailer, AR, etc.)
- Handling events

Please, temporarily, read the property comments in the code for usage of them.

Contact Me
----------

[](#contact-me)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

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

Unknown

Total

1

Last Release

4028d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24b9c895878eaca851454016037710da8d80c7ae8cae887ff27e6a76e4be3b7a?d=identicon)[thinker-g](/maintainers/thinker-g)

---

Top Contributors

[![thinker-g](https://avatars.githubusercontent.com/u/3844316?v=4)](https://github.com/thinker-g "thinker-g (12 commits)")[![tkrg](https://avatars.githubusercontent.com/u/5262876?v=4)](https://github.com/tkrg "tkrg (9 commits)")

---

Tags

yii2emailingdistributedmulti-process

### Embed Badge

![Health badge](/badges/thinker-g-yii2-hermes-mailing/health.svg)

```
[![Health](https://phpackages.com/badges/thinker-g-yii2-hermes-mailing/health.svg)](https://phpackages.com/packages/thinker-g-yii2-hermes-mailing)
```

###  Alternatives

[nterms/yii2-mailqueue

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

87129.2k2](/packages/nterms-yii2-mailqueue)[loveorigami/yii2-notification-wrapper

This module for renders a message from session flash (with ajax, pjax support and etc.)

77199.7k5](/packages/loveorigami-yii2-notification-wrapper)[tuyakhov/yii2-notifications

The extension provides support for sending notifications across a variety of delivery channels, including mail, SMS, Slack etc. Notifications may also be stored in a database so they may be displayed in your web interface.

6735.5k2](/packages/tuyakhov-yii2-notifications)[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)
