PHPackages                             tigrov/yii2-mailqueue - 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. tigrov/yii2-mailqueue

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

tigrov/yii2-mailqueue
=====================

Yii2 mail queue component for yii2-swiftmailer.

1.1.5(6y ago)196.6k4MITPHP

Since Oct 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Tigrov/yii2-mailqueue)[ Packagist](https://packagist.org/packages/tigrov/yii2-mailqueue)[ Docs](https://github.com/tigrov/yii2-mailqueue)[ RSS](/packages/tigrov-yii2-mailqueue/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

yii2-mailqueue
==============

[](#yii2-mailqueue)

Yii2 mail queue component for [yii2-symfonymailer](https://www.yiiframework.com/extension/yiisoft/yii2-symfonymailer).

[![Latest Stable Version](https://camo.githubusercontent.com/fd1baf4eec9e82468d9981bcf4dccf9893fed563278884fd060cb2042e8fd02b/68747470733a2f2f706f7365722e707567782e6f72672f546967726f762f796969322d6d61696c71756575652f762f737461626c65)](https://packagist.org/packages/Tigrov/yii2-mailqueue)

Limitation
----------

[](#limitation)

Since 1.1.6 requires PHP &gt;= 8.1

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist tigrov/yii2-mailqueue "~1.1.1"

```

or add

```
"tigrov/yii2-mailqueue": "~1.1.6"

```

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

Configuration
-------------

[](#configuration)

Once the extension is installed, add following code to your application configuration:

```
return [
    // ...
    'components' => [
        'mailer' => [
            'class' => 'tigrov\mailqueue\Mailer',
            'table' => '{{%mail_queue}}',
            'maxAttempts' => 5,
            'attemptIntervals' => [0, 'PT10M', 'PT1H', 'PT6H'],
            'removeFailed' => true,
            'maxPerPeriod' => 10,
            'periodSeconds' => 1,
        ],
    ],
    // ...
];
```

Following properties are available for customizing the mail queue behavior.

- `table` name of the database table to store emails added to the queue;
- `maxAttempts` maximum number of sending attempts per email;
- `attemptIntervals` seconds or interval specifications to delay between attempts to send a mail message, see ;
- `removeFailed` indicator to remove mail messages which were not sent in `maxAttempts`;
- `maxPerPeriod` number of mail messages which could be sent per `periodSeconds`;
- `periodSeconds` period in seconds which indicate the time interval for `maxPerPeriod` option.

Updating database schema
------------------------

[](#updating-database-schema)

Run `yii migrate` command in command line:

```
php yii migrate/up --migrationPath=@vendor/tigrov/yii2-mailqueue/src/migrations/

```

Sending the mail queue
----------------------

[](#sending-the-mail-queue)

To sending mails from the queue call `Yii::$app->mailer->sending()` or run the console command `yii mailqueue` which can be triggered by a CRON job:

```
* * * * * php /var/www/vhosts/domain.com/yii mailqueue/sending

```

After the mail message successfully sent it will be deleted from the queue.

Usage
-----

[](#usage)

You can then send a mail to the queue as follows:

```
Yii::$app->mailer->compose('contact/html')
     ->setFrom('from@domain.com')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->setTextBody($form->body)
     ->delay('PT3M') // seconds or an interval specification to delay of sending the mail message, see http://php.net/manual/en/dateinterval.construct.php
     ->unique('unique key') // a unique key for the mail message, new message with the same key will replace the old one
     ->queue();
```

You can still send mails directly with `yii2-swiftmailer`:

```
Yii::$app->mailer->compose('contact/html')
     ->setFrom('from@domain.com')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->setTextBody($form->body)
     ->send();
```

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~50 days

Recently: every ~75 days

Total

7

Last Release

2518d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2112911?v=4)[Tigros](/maintainers/Tigros)[@tigros](https://github.com/tigros)

---

Top Contributors

[![Tigrov](https://avatars.githubusercontent.com/u/8563175?v=4)](https://github.com/Tigrov "Tigrov (12 commits)")[![evil1](https://avatars.githubusercontent.com/u/5018681?v=4)](https://github.com/evil1 "evil1 (2 commits)")

---

Tags

mailqueueyii2yii2-extensionmailemailqueueyii2extensiondelay

### Embed Badge

![Health badge](/badges/tigrov-yii2-mailqueue/health.svg)

```
[![Health](https://phpackages.com/badges/tigrov-yii2-mailqueue/health.svg)](https://phpackages.com/packages/tigrov-yii2-mailqueue)
```

###  Alternatives

[nterms/yii2-mailqueue

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

84135.6k2](/packages/nterms-yii2-mailqueue)[boundstate/yii2-mailgun

Mailgun integration for the Yii framework

28168.1k](/packages/boundstate-yii2-mailgun)[rmrevin/yii2-postman

Mail module for Yii2.

2912.3k](/packages/rmrevin-yii2-postman)

PHPackages © 2026

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