de-facto library used for sending emails I’m the maintainer since 2009 Code infrastructure is still the same as version 4.0, roughly released at the same time as Symfony 1.2 … code is getting old!
way of writing PHP code … which is not a “big” problem as developers rarely need to interact with Swiftmailer internals… except for me, the maintainer … which means that Swiftmailer is not really maintained
with style{% endblock %} {% block text %} Optional text representation {% endblock %} {% block content %} <h1>Welcome to Elephpant Land!</h1> <p>We're very pleased to welcome you on-board.</p> <p>And we're very proud of our on-boarding e-mails!</p> {% email_box %} <h1>Sign-up now!</h1> <p> Get a new Elephpant photo in your inbox each day<br> ... for only 4€ a month </p> {% email_button "https://somewhere.com/" %}Sign me up!{% endemail_button %} {% endemail_box %} {% endblock %} Responsive Emails
$rate; public function setDiscountRate(int $rate): self { $this->rate = $rate; return $this; } public function getDiscountRate(): int { return $this->rate; } public function getTemplate(): string { return 'emails/promotion.html.twig'; } } Package your emails in a class
return new Response('Sent'); } public function emailAsync(MessageBusInterface $bus) { $email = (new Email())->…; $bus->dispatch($email); return new Response('Sent'); } Messages via Messenger
$this->transport = $transport; } public function __invoke(Email $email) { $this->transport->send($email); } } <service id="mailer.messenger.email_handler" class="Symfony\Component\Mailer\Messenger\EmailHandler" public="false"> <argument type="service" id=“transport.transport" /> <tag name="messenger.message_handler" /> </service> Here is the magic that makes it work!
CSS selector Event Dispatcher Dependency Injection Container Symfony Polyfills (punycode, intl, …) … with all the great features you love in Swiftmailer 6 Symfony Mailer