You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
725 B
PHTML
36 lines
725 B
PHTML
6 years ago
|
<?php
|
||
|
|
||
|
namespace Engelsystem\Mail;
|
||
|
|
||
|
use Engelsystem\Renderer\Renderer;
|
||
|
use Swift_Mailer as SwiftMailer;
|
||
|
|
||
|
class EngelsystemMailer extends Mailer
|
||
|
{
|
||
|
/** @var Renderer|null */
|
||
|
protected $view;
|
||
|
|
||
|
public function __construct(SwiftMailer $mailer, Renderer $view = null)
|
||
|
{
|
||
|
parent::__construct($mailer);
|
||
|
|
||
|
$this->view = $view;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Send a template
|
||
|
*
|
||
|
* @param string $to
|
||
|
* @param string $subject
|
||
|
* @param string $template
|
||
|
* @param array $data
|
||
|
* @return int
|
||
|
*/
|
||
|
public function sendView($to, $subject, $template, $data = []): int
|
||
|
{
|
||
|
$body = $this->view->render($template, $data);
|
||
|
|
||
|
return $this->send($to, $subject, $body);
|
||
|
}
|
||
|
}
|