Create a Mail plug-in that emulates swiftmailer

Created on 15 October 2022, about 2 years ago
Updated 20 October 2023, about 1 year ago

Problem/Motivation

Given that swiftmailer is unsupported, then sites need a drop-in replacement that is the minimum possible change.

Proposed resolution

  • Rename sub-module "Symfony Mailer Back-compatibility" to "Symfony Mailer Replace"
  • Move LegacyEmailBuilder into the symfony_mailer module - it will be used in both "replace" and "plug-in" modes of operation.
  • Create a new service LegacyMailerHelper. Move in the code from LegacyEmailBuilder::emailFromArray(), splitting out the part for the body into a separate function formatBody(). Create another function mail() taking code from MailManagerReplacement::mail().
  • Create a plug-in class SymfonyMailer of type @Mail which maps directly onto functions from LegacyEmailBuilder.

Equivalence of swiftmailer code:

  • Code relating to swiftmailer.transport config is taken over by Symfony Mailer transport configuration. SwiftmailerEmailBuilder contains an import function.
  • Code relating to swiftmailer.message config is mostly handled by other settings. Content type maps to the new adjuster from #3264279: Send email as plaintext .
  • Character set (if still relevant today) would map to a new adjuster. Symfony Mailer library will always generate a plain text so that's redundant. Text format (if still needed) would likely need to be a new config setting.
  • Code relating to attachments is mostly handled by Symfony Mailer automatically.
  • Hooks: We can't support hook_swiftmailer_alter() as it takes the swiftmailer specific class. We could probably support hook_swiftmailer_attach(), it could be an EmailProcessor.
  • Library: We could support the swiftmailer library - this could be an EmailProcessor.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom adamps

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024