← Back
Editing: ReportEmailSender.php
<?php namespace App\Report\Control; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Component\Mailer\Exception\TransportExceptionInterface; use Symfony\Component\Mailer\MailerInterface; class ReportEmailSender { public function __construct( private readonly MailerInterface $mailer, private readonly string $fromMail) { } /** * @throws TransportExceptionInterface */ public function __invoke(string $title, string $recipient, string $htmlTemplate, array $context, array $cc = []): void { $email = (new TemplatedEmail()) ->subject($title) ->from($this->fromMail) ->to($recipient) ->cc(...$cc) ->htmlTemplate($htmlTemplate) ->context($context); $this->mailer->send($email); } }
Save File
Cancel