Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

AppsDevTeam/background-queue-mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BackgroundQueueMailer

Delegates sending emails to adt/background-queue.

Installation

composer:

composer require adt/background-queue-mailer

If you're not familiar with adt/background-queue, you should head there in the first place.

Usage

To use BackgroundQueueMailer as buffer between your application and SmtpMailer, register it in your config.neon:

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.

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.

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.

You cannot set autowired: no on nette.mailer because your application would not be able to inject it.

It is also important that you autowire \Nette\Mail\IMailer throughout your application.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

12 watching

Forks

Packages

 
 
 

Contributors

Languages