The end of Swiftmailer

The Symfony Mailer component was released for the first time in Symfony 4.3, released in May 2019. Since then, we have worked on improving it by adding more third-party providers and adding some missing features that were already available in Swiftmailer, like DKIM support and email signing. As of Symfony 5.3, all Swiftmailer great features and more are available in Symfony Mailer. Now comes the time to officially end the maintenance of Swiftmailer in favor of Symfony Mailer. I've set the end of maintenance date to the end of November 2021, at the same time as the Symfony 5.4 LTS and 6.0 release. Symfony Mailer could actually have been called Swiftmailer version 7 and the work started exactly as the next major version of Swiftmailer. Let's dive a bit into how I decided to create Symfony Mailer instead of releasing Swiftmailer 7. The current code infrastructure for Swiftmailer was designed for version 4.0, which was roughly released at the same time as symfony 1.2! For many years, I've tried to work on modernizing the Swiftmailer code base one step at a time by trying to introduce namespaces, move to the Composer autoloader, trying to remove the special (and heavy) "boot sequence", trying to switch to the Symfony dependency injection and event dispatcher components. But all my efforts always finished as dead ends, probably because the task was too important for little benefits as Swiftmailer suffers from many more conceptual issues: it has a weird and complex class inheritance and message instances are not data objects which makes it painful to serialize them. It also lacks some modern features like supporting Twig for composing emails and support for third-party providers. Both features could have been added to the current code base, but it would have been ideal. Another issue is the way Swiftmailer uses a "spool" mechanism to support asynchronous emails; it barely works and it's not very flexible. I can go on and on, but you get the idea. So, at some point, I decided to start again, but with a very different and radical approach. Instead of trying to modernize the code one step at a time, I've copied the code and started to first work on isolating a Symfony Mime component. Then, I refactored the rest of the code base as much as possible to create Symfony Mailer. The result is Symfony Mailer. Symfony Mailer has quite a lot of code in common with Swiftmailer but none of its idiosyncrasies. Migrating from Swiftmailer to Symfony Mailer is a relatively easy task as the concepts are the same between the two projects.

                Sponsor the Symfony project.

http://feedproxy.google.com/~r/symfony/blog/~3/bEELWgMiLak/the-end-of-swiftmailer

Created 4y | Aug 19, 2021, 8:20:07 AM


Login to add comment

Other posts in this group

Symfony meetup: Join Nicolas Grekas in Tunis on April 12th!

Nous sommes heureux de vous annoncer le retour des meetups Symfony à Tunis !🎉 Rejoignez dès maintenant le groupe "Symfony User group Tunis" pour suivre les actualités et futurs meetup de la communauté

Apr 2, 2025, 7:10:06 AM | Symfony
A Week of Symfony #952 (March 24–30, 2025)

This week, Symfony 6.4.20 and 7.2.5 maintenance versions were released. In addition, Symfony successfully celebrated the SymfonyLive Paris 2025 conference and continued preparations for next week's Sy

Mar 30, 2025, 9:30:09 AM | Symfony
Symfony 6.4.20 released

Symfony 6.4.20 has just been released. Here is the list of the most important changes since 6.4.19:

bug #60054 [Form] Use duplicate_preferred_choices to set value of ChoiceType (@aleho)

bug #5985

Mar 28, 2025, 3:40:28 PM | Symfony
Symfony 7.2.5 released

Symfony 7.2.5 has just been released. Here is the list of the most important changes since 7.2.4:

bug #60054 [Form] Use duplicate_preferred_choices to set value of ChoiceType (@aleho)

bug #60026

Mar 28, 2025, 3:40:27 PM | Symfony
SymfonyLive Berlin 2025 starts in a week!

SymfonyLive Berlin 2025 is almost here! Join us next week for an exciting event filled with fresh talks, inspiring speakers, and everything you need to make the most of this incredible gatheri

Mar 26, 2025, 8:10:11 AM | Symfony
New Core Team Member, Symfony CLI

After announcing the Symfony UX Core Team and adding more core team members earlier this year, I'm back again with a great addition to the Symfony Core Team. I'm very excited to announce that Tugdual

Mar 24, 2025, 4:40:18 PM | Symfony
A Week of Symfony #951 (March 17–23, 2025)

This week, the upcoming Symfony 7.3 version updated its default configuration to exclude container extensions, entities and messenger messages when registering services, and made some changes related

Mar 23, 2025, 10:40:03 AM | Symfony