Files
backend/src/Service/Mail/SendMailService.php
T
2026-05-27 19:36:32 +03:00

30 lines
696 B
PHP

<?php
declare(strict_types=1);
namespace App\Service\Mail;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
final class SendMailService
{
public function __construct(
private MailerInterface $mailer,
private string $fromEmail = 'noreply@sova.clinic',
private string $fromName = 'Sova Clinic'
) {
}
public function send(string $mailto, string $subject, string $message): void
{
$email = (new Email())
->from(sprintf('%s <%s>', $this->fromName, $this->fromEmail))
->to($mailto)
->subject($subject)
->text($message);
$this->mailer->send($email);
}
}