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

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

dejvidecz/yii2-mailqueue
========================

Modified Yii2 mail queue component for own system purpose

v1.0.0(8y ago)0375MITPHP

Since Nov 24Pushed 8y ago1 watchersCompare

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

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

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

[](#yii2-mailqueue)

Yii2 mail queue component for [yii2-swiftmailer](http://www.yiiframework.com/doc-2.0/ext-swiftmailer-index.html).

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 "*"

```

or add

```
"tigrov/yii2-mailqueue": "*"

```

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

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3093d ago

### Community

Maintainers

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

---

Top Contributors

[![dejvidecz](https://avatars.githubusercontent.com/u/10745725?v=4)](https://github.com/dejvidecz "dejvidecz (3 commits)")

---

Tags

mailemailqueueyii2extensiondelay

### Embed Badge

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

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

###  Alternatives

[tigrov/yii2-mailqueue

Yii2 mail queue component for yii2-swiftmailer.

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

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

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

Mailgun integration for the Yii framework

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

Mail module for Yii2.

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

PHPackages © 2026

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