Download the PHP package svb/mailing without Composer
On this page you can find all versions of the php package svb/mailing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package mailing
Short Description Enable third party mailing via connectors that provide api access for sending templated e-mails
License MIT
Informations about the package mailing
SVB Mailing
This bundle has been developed in order to send mails from multiple systems without writing a single line of html nor care about any localizations.
How to install/configure
composer require svb/mailing
- Make sure the bundle is correctly registered in either
config/bundles.php
(sf4/5) orapp/AppKernel.php:registerBundles
(sf3) - Add a configuration for the bundle like this:
How to use
- Inject the service
svb_mailing.mailer
(SVB\Mailing\Mailer when using the sf auto wiring) - Create one or more mail objects using one of the many mail templates located within the namespace
SVB\Mailing\Mail\
- Pass your object(s) into the sendMails method of the
svb_mailing.mailer
service - You mail should either been sent, or you should have got an exception what to do
Adding Mail Templates
- Create a new class implementing MailInterface (AbstractMail to make your life a bit easier)
Hint: Mail Templates do not necessarily need to be in one folder, use sub directories to order them! - Add the template to the parameter "svb_mailing.mail_identifiers" (identifier string => fully qualified classname)
Pro tip: Definitely consider creating a reusable bundle for your templates, that way you can use your templates across all projects!
Asynchronous resending of failed messages
Since most provider handle sent messages using message queues, most responses for a "send" request will return "200 OK".
The mailing bundle provides easy functionality for checking message states and resending failed messages using a database
to store all messages and their states. Since the worker for this needs to be executed asynchronously, we implemented a
symfony command for this: bin/console svb:mailing:worker
. Make sure this command is executed at least once every hour
(the more frequent it's executed the better!) to ensure your mails getting resent, and the states are updated correctly.
All versions of mailing with dependencies
symfony/dependency-injection Version ^3.4|^4.3
symfony/http-kernel Version ^3.4|^4.3
symfony/config Version ^3.4|^4.3
doctrine/dbal Version ^2.0|^3.0
symfony/console Version ^4.0|^5.0
ext-json Version *