Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
716cf56cb2.url-de-test.ws
/
htdocs
/
src
/
Service
/
/srv/data/web/vhosts/716cf56cb2.url-de-test.ws/htdocs/src/Service/Mailer.php
<?php namespace App\Service; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Routing\RouterInterface; class Mailer { /** * @var MailerInterface */ private $mailer; private $router; private $parameterBag; public function __construct(MailerInterface $mailer, RouterInterface $router, ParameterBagInterface $parameterBag) { $this->mailer = $mailer; $this->router = $router; $this->parameterBag = $parameterBag; } public function mailContact($mail) { $email = (new TemplatedEmail()) ->from("contact@bhinternet.fr") ->to($this->parameterBag->get('conf_email')) ->subject("Contact - A casa") ->htmlTemplate('Front/Emails/email-contact.html.twig') ->context(["data" => $mail]); $this->mailer->send($email); } public function bookingClient($booking) { $email = (new TemplatedEmail()) ->from("contact@bhinternet.fr") ->to($booking->getUserEmail()) ->subject("Confirmation de réservation - A casa") ->htmlTemplate('Front/Emails/confirmation-client.html.twig') ->context(["data" => $booking]); $this->mailer->send($email); } public function bookingAdmin($booking) { $email = (new TemplatedEmail()) ->from("contact@bhinternet.fr") ->to($this->parameterBag->get('conf_email')) ->subject("Nouvelle réservation - A casa") ->htmlTemplate('Front/Emails/confirmation-admin.html.twig') ->context(["data" => $booking]); $this->mailer->send($email); } public function payRest($booking) { $url = $this->router->generate("app_pay_rest_booking", ["token" => $booking->getTokenRest()], RouterInterface::ABSOLUTE_URL); $email = (new TemplatedEmail()) ->from("contact@bhinternet.fr") ->to($booking->getUserEmail()) ->subject("Reste à payer - A casa") ->htmlTemplate('Front/Emails/pay-rest.html.twig') ->context(["data" => $booking, "url" => $url]); $this->mailer->send($email); } public function bookingCancel($booking) { $email = (new TemplatedEmail()) ->from("contact@bhinternet.fr") ->to($booking->getUserEmail()) ->bcc($this->parameterBag->get('conf_email')) ->subject("Annulation de réservation - A casa") ->htmlTemplate('Front/Emails/confirmation-annulation.html.twig') ->context(["data" => $booking]); $this->mailer->send($email); } }