stesi/mail-dispatcher

Inserts the email to be sent to the database and after sends them. This project use Propel2 as ORM.

dev-master 2016-10-12 10:36 UTC

This package is not auto-updated.

Last update: 2024-05-11 17:45:19 UTC


README

Usage:



 //Create new template and set param to substitute in template
$template = (new Template ())
	->setTemplateName ( "test" )
	->addKeyVal ( (new KeyVal ())
		->setKey ( "Name" )
		->setVal ( "Mauro" ) )
	->addKeyVal ( (new KeyVal ())
		->setKey ( "Surname" )
		->setVal ( "Cerone" ) )
	->addKeyVal ( (new KeyVal ())
		->setKey ( "NickName" )
		->setVal ( "ceronem" ) );
//Create contact, FROM and A
$a = (new Contact ())->setAddress("cerone.m@stesi.eu");
$from = (new Contact())->setAddress("mauro.cerone@gmail.com");
//Add contact and template to Email object
$email = (new Email())
	->setTemplate($template)
	->setFrom($from)
	->addA($a)
	->setSubject("Test Email");
//Add email to the send queue
STeSI\MailDispatcher\Mailer::addMailToSend($email);
//Send all mail in send queue
STeSI\MailDispatcher\Mailer::startSendOperation();