I'm building a website with symfony 4, today I try to send email with the emailBundle of symfony i'm using also the mailgun bundle as transport. Everything is well configured.
When I send email the classic way with ->text() or ->html() everything work but when I use twig templating for email I get this error :
Unable to send an email: Need at least one of 'text' or 'html' parameters specified (code 400).
This is the code part for mail sending :
<?php
$email = (new TemplatedEmail())
->from(new NamedAddress('blabla','blabla'))
->to($user->getEmail())
->subject('Account registration')
->htmlTemplate('emails/signup.html.twig')
->context([
'firstName' => $user->getFirstName(),
'email' => $user->getEmail(),
'url' => $_ENV['blabla'].'/account'
]);
$transport = new MailgunTransport($_ENV['blabla'],$_ENV['blabla']);
$mailer = new Mailer($transport);
$mailer->send($email);
?>
Thanks in advance