2017 © Pedro Peláez
 

library mail-queue

The ultimate Nette mailing solution.

image

adt/mail-queue

The ultimate Nette mailing solution.

  • Wednesday, June 27, 2018
  • by michallohnisky
  • Repository
  • 5 Watchers
  • 0 Stars
  • 509 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 20 Versions
  • 16 % Grown

The README.md

MailQueue

Allows in-app mail queueing and delayed sending., (*1)

1.1 Installation

composer:, (*2)

composer require adt/mail-queue

config.neon:, (*3)

extensions:
    adtMailQueue: ADT\MailQueue\DI\MailQueueExtension

1.1.1 Using default Queue entity

Let Doctrine know about our entity:, (*4)

doctrine:
    metadata:
        ADT\MailQueue\Entity: %vendorDir%/adt/mail-queue/src/Entity

1.1.2 Using custom Queue entity

Create your own entity that extends our abstract entity:, (*5)

namespace App\Model\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class QueueEntity extends \ADT\MailQueue\Entity\AbstractMailQueueEntry {

    /**
     * @ORM\Column(type="text")
     */
    protected $customProperty;

}

Let us know about your custom entity:, (*6)

adtMailQueue:
    queueEntityClass: App\Model\Entity\QueueEntity

To fill custom properties of your entity when enqueueing mail, you can use second argument of enqueue:, (*7)

$this->mailQueueService->enqueue($mail, [
    'customProperty' => 'customValue'
]);

or, (*8)

$this->mailQueueService->enqueue($mail, function (QueueEntity $e) {
    $e->customProperty = 'customValue';
});

1.2.1 Using one and only IMailer

adtMailQueue:
    mailer: @sparkPostApiMailerService

1.2.2 Custom mailer

If you need to decide which mailer you want to use based on information in your custom Queue entity, you can implement ADT\MailQueue\Service\IMessenger interface. This interface has send($entity) method where $entity is your custom entity., (*9)

adtMailQueue:
    messenger: @queueMailerMessenger

1.3 Migration

Clear your temp/cache directory., (*10)

Generate migration and migrate:, (*11)

php www/index.php migrations:diff
php www/index.php migrations:migrate

1.4 Processing enqueued messages

Use predefined console command:, (*12)

php www/index.php mail-queue:process

or get ADT\MailQueue\Services\QueueService from DI container and call:, (*13)

$queueService->process()

1.5 Send error handler

If you need to handle send error, you can set:, (*14)

adtMailQueue:
    sendErrorHandler: @ErrorHandlerClass::handlerMethod

Handler method receives queue entry entity and exception generated on send., (*15)

1.6 Queue drained event

If you need notification when queue is drained, you can set:, (*16)

adtMailQueue:
    onQueueDrained: @EventHandlerClass::handlerMethod

Event handler receives instance of OutputInterface if available, NULL otherwise., (*17)

2.1 Configuration

adtMailQueue:
    messenger: #or mailer
    queueEntityClass: #default Entity\MailQueueEntry::class,
    autowireMailer: false
    sendErrorHandler: null
    onQueueDrained: null
    lockTimeout: 600
    limit: 1000 #how many emails send
    tempDir: %tempDir%
    backgroundQueueService: @ADT\BackgroundQueue\Service
    backgroundQueueCallbackName: mailSending

The Versions

27/06 2018

dev-master

9999999-dev

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

27/06 2018

v1.3

1.3.0.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

03/03 2018

v1.2.9

1.2.9.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

07/10 2017

v1.2.8

1.2.8.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

06/10 2017

v1.2.7

1.2.7.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

06/10 2017

v1.2.6

1.2.6.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

06/10 2017

v1.2.5

1.2.5.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

13/06 2017

v1.2.4

1.2.4.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

31/05 2017

v1.2.3

1.2.3.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

26/05 2017

v1.2.2

1.2.2.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

12/04 2017

v1.2.1

1.2.1.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

21/03 2017

v1.2

1.2.0.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

24/02 2017

v1.1.6

1.1.6.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

29/09 2016

v1.1.5

1.1.5.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

29/09 2016

v1.1.4

1.1.4.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

29/09 2016

v1.1.3

1.1.3.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

29/09 2016

v1.1.2

1.1.2.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

29/09 2016

v1.1.1

1.1.1.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

29/09 2016

v1.1

1.1.0.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam

27/09 2016

v1.0.0

1.0.0.0

The ultimate Nette mailing solution.

  Sources   Download

MIT

The Requires

 

by AppsDevTeam