Background Queue Mailer
Delegates sending emails to adt/background-queue., (*1)
Installation
composer require adt/background-queue-mailer
Usage
services:
smtpMailer:
class: \Nette\Mail\SmtpMailer
autowired: no # this is important
nette.mailer: \ADT\Mail\BackgroundQueueMailer\Mailer(@smtpMailer, 'backgroundMail')
backgroundQueue:
callbacks:
backgroundMail: @nette.mailer::process
where @smtpMailer is outgoing mailer, and backgroundMail is unique callback name., (*2)
Callback name has to be same in both mailer definition and BackgroundQueue callback list. If they
are not, warning is logged using Tracy. This should get resolved here., (*3)
The autowired: no option is important because Nette DI container would not know
which \Nette\Mail\IMailer to inject in your application. By setting autowired: no on
SMTP mailer only one instance of IMailer interface remains., (*4)
You cannot set autowired: no on nette.mailer because your application
would not be able to inject it., (*5)
It is also important that you autowire \Nette\Mail\IMailer throughout your application., (*6)