Отправка сообщений через Swift_Mailer | Sending Messages Swift_Mailer

Пример использования в сервисе:

class MailSender
{
    private $twig;
    private $mailer;
     
    public function __construct(Swift_Mailer $mailer, Twig_Environment $twig) 
    {
        $this->mailer = $mailer;
         $this->twig = $twig;
    }
     
     public function sendFeedback(array $data): void
    {
        $email = \Swift_Message::newInstance()
            ->setSubject($data['subj'])
			->setFrom($data['from'])
            ->setTo($data['to'])
            ->setBody($config['body'], 'text/html')
			->setContentType("text/html");
        $this->mailer->send($email);
    }
}

Подробнее:
swiftmailer.symfony.com - Creating Messages