-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swiftmailer is end-of-life. Need to upgrade to Symfony Mailer #10097
Comments
Maybe we should take this opportunity to switch to an adapter pattern, and then it would theoretically be less of a problem with this situation in the future. |
@frankmullenger @danaenz How will this impact S/MIME? |
Realistically we're only going to give proper to support to one mailer, almost certainly SymfonyMailer. An adapter pattern sounds like it could be over-abstraction? I think the FullTextSearch module started off with similar thinking and just ended up as an over-abstraction for solr To be fair, email is a lot simpler than search so extra-abstraction would be less painful. Could make sense if we need to dual support both SwiftMailer v6 + SymfonyMailer? We must prevent email from breaking on upgrade for the same reasons we backported v5 MailTransport in our own codebase Whatever we do, any existing project config for email is probably going to stop working cos the classnames change :-/ |
I don't think you can really ever classify an email adapter as over abstraction to be honest. It's abstraction for a completely valid reason. I think the FullTextSearch module just failed to implement the adapter pattern, so ended up not actually being an abstraction at all, just a bunch of cruft around Solr. You could get the side effect of being able to keep existing deprecated SwiftMailer code and also adding support for SymfonyMailer. You'd also get the benefits of simpler guidance around development environments (using something like MailTrap). Other benefits include improved testability of Mail APIs. Abstraction of complicated per-mailer logic into their own adapters, potentially simplifying the interfaces. Downside is that it might be hard to do without breaking changes, but I guess that's why Max is saying " |
Right now we've got Email.php which extends ... ViewableData :-) We'll need to keep the API in Email.php as is since that's how you send Emails in SIlverstripe Looks like it was there was some intention at some point to have the mailer swappable:
But right now Email.php is pretty hardcoded to swiftmailer A) B) silverstripe/mailer) |
I think refactoring to use SymfonyMailer makes a lot of sense. SymfonyMailer supports the standard built-in transports like smtp and sendmail (https://symfony.com/doc/current/mailer.html#using-built-in-transports) but also has a lot of third-party transports available already (https://symfony.com/doc/current/mailer.html#using-a-3rd-party-transport). |
We have a module we use on almost all of our sites (signify-nz/silverstripe-mailblock) which includes a plugin for Swiftmailer - dropping support for Swiftmailer altogether in favour of SymfonyMailer would break that module. IMO while it would be good to provide support for SymfonyMailer, Swiftmailer also needs to be supported until SS5.0 for backwards compatability, since dropping it would be a breaking change. |
Looking at the mail config, we could implement a silverstripe-framework/_config/email.yml Lines 1 to 12 in 49a7f08
|
Isn't |
Yes technically? Mailer is very lightweight interface - it's set here here. I'd be surprised if you could just swap this out and things just work. I'd assume that in the codebase there are various calls to email methods that are not defined in the Mailer interface The work for actually sending mails is done by Email (and the Email class is a docblock param for the Mailer interface anyway). Email is very much hardcoded to SwiftMailer e.g. https://github.com/silverstripe/silverstripe-framework/blob/4/src/Control/Email/Email.php#L263 Seems messy to turn this into an adapter at this stage in CMS4. We have CMS5 on the horizon so that gives us the opportunity to do this cleaner |
All PRs merged. |
Overview
Symfony recently announced that maintenance of Swiftmailer will officially end in November 2021 in favour of Symfony Mailer. See EOL announcement.
We'll need to investigate the migration path and set a plan for doing this work.
Acceptance criteria
Side note
PRs
The text was updated successfully, but these errors were encountered: