JaegerApp\Email
is an email abstraction that works with both SwiftMailer 3 and 5 (depending on which is already available). Note that the Email object does NOT include any version of SwiftMailer and relies on the host system to provide one.
On top of that, JaegerApp\Email
works with the JaegerApp\Language
(for copy abstraction), and JaegerApp\View
(for templating of email messages) using the Mustache templating language.
Add jaeger-app/email
as a requirement to your composer.json
:
$ composer require jaeger-app/email
At its purest, sending an email using JaegerApp\Email
looks like the below (albeit not 100%):
$vars = array('variable1' => 'Variable1');
$email->setSubject($subject)
->setMessage($message_template)
->setTo($emails)
->addAttachment($file)
->setMailtype('html');
$email->send($vars);