Review main Merged

95026[FEATURE] Add named mail profiles

Benni Mack CR +2 V +2 Expert +1139 −59 updated 11/20/26, 16:43

Commit message

Sending emails through more than one provider within a single
installation required custom code so far, since the transport was
built from the global MAIL configuration only.

Named mail profiles are now configured in

  $GLOBALS['TYPO3_CONF_VARS']['MAIL']['profiles']

using the same keys as the global MAIL configuration. A profile is
merged on top of the global settings and therefore only has to
define the keys that differ from them.

The new MailerFactory hands out a mailer for a given profile, so a
consumer can pick the transport per email, for example to deliver
newsletters through a bulk provider while transactional emails keep
using the regular SMTP server. Mailers are kept per profile to reuse
an established SMTP connection. Without a profile, the factory
returns the injected global mailer.

Besides the transport, a profile also provides the sender defaults,
which are now read from the settings of the mailer instead of the
global configuration.

The spool settings are not inherited by a profile, as spooled emails
must be sent through the transport they were spooled with. A memory
spool is now flushed through the transport of its own settings
instead of the one of the global mailer, and a file spool of a
profile has to be flushed with "mailer:spool:send --profile". A file
spool directory may only be used by one configuration.

A profile with its own transport, SMTP server or DSN does not inherit
the global SMTP credentials, so they are never sent to another server.

The new value object SenderDefaults resolves the sender and reply-to
addresses from the global settings or the settings of a profile, so
the Mailer no longer relies on MailUtility for them.

Credentials of a profile are masked in the configuration module just
like those of the global MAIL configuration.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Josua Vogel +1
  • Verified V +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Josua Vogel +1
    • core-ci +1 CI

Issues 2

Files 19

Review log 2125

  1. Benni Mack uploaded patch set 1 07/30/26, 20:12

  2. core-ci voted on patch set 1 V +1 07/30/26, 20:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105712

  3. Simon Schaufelberger voted on patch set 1 CR +1 08/01/26, 20:22

  4. Oliver Klee voted on patch set 1 V +1 08/02/26, 08:52

  5. Garvin Hicking commented on patch set 1 09/25/26, 15:02

    How would you feel about this be implemented alongside a "mail profiles per site" configuration? It would be cool to define all the mail related things per site. Then we could also set up "dummy" sites that contain specific bulk sending configs that could be used on CLI contexts...? The upside would be to be able to nicely configure this with FormEngine inside the GUI, and not have a "messy" PHP array? Also, this would allow to utilize environment/deployment-specific configurations (of course, also possible with additional.php)
  6. Garvin Hicking commented on patch set 1 09/25/26, 15:29

    Reply

    Oh I see, https://review.typo3.org/c/Packages/TYPO3.CMS/+/95027 is what deals with this, I did not notice. (let's set a cross-issue- "Related:" in both?)
  7. Garvin Hicking commented on patch set 1 09/25/26, 15:31

    Reply

    ... I'd still see benefits in people being able to define sender mail addresses and sender names in the GUI (site settings), and not in a profile?
  8. Benni Mack uploaded patch set 2 CR +1 V +1 11/13/26, 18:01

  9. Benni Mack commented on patch set 2 11/13/26, 18:04

    Reply

    Related: done. Site selection is in #95027. The profiles stay in settings.php because they contain credentials.
  10. Benni Mack rebased onto patch set 3 11/14/26, 06:52

  11. core-ci voted on patch set 3 V +1 11/14/26, 07:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114418

  12. Josua Vogel commented on patch set 3 11/16/26, 08:32

    I think the sensible data (password, ... ) should be masked inside configuration overview (lowlevel) like the database credentials
  13. Benni Mack uploaded patch set 4 V +1 11/18/26, 20:27

  14. core-ci voted on patch set 4 V +1 11/18/26, 20:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114918

  15. Benni Mack commented on patch set 4 11/18/26, 21:30

    Reply

    Done
  16. Josua Vogel commented on patch set 4 11/19/26, 08:28

    SendEmailCommand.php:40

    This is breaking, when someone extended the SendEmailCommand. I think we should mention this.
  17. Benni Mack commented on patch set 4 11/19/26, 09:52

    SendEmailCommand.php:40 Reply

    but this boils down to "when somebody XCLASSes something, we do not cover this in the BW-compat"
  18. Josua Vogel commented on patch set 4 CR +1 V +1 11/19/26, 09:57

    SendEmailCommand.php:40 Reply

    Acknowledged
  19. Fabien Udriot voted on patch set 4 CR +1 11/19/26, 15:50

  20. Benni Mack uploaded patch set 5 CR +1 V +1 11/19/26, 17:33

  21. core-ci voted on patch set 5 V +1 11/19/26, 17:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115034

  22. Garvin Hicking commented on patch set 5 CR +1 V +1 11/20/26, 16:14

    This change is ready for review.
    Works well for me. Also in conjunction with the BeforeMailerSentMessageEvent (which takes priority, as I would expect).
  23. Josua Vogel voted on patch set 5 CR +1 V +1 11/20/26, 16:42

  24. Benni Mack commented on patch set 5 CR +2 V +2 11/20/26, 16:43

    thank you!
  25. Benni Mack merged patch set 6 11/20/26, 16:43