Issue Feature Under Review

#107307Site Settings for SMTP Mail settings per site

Lina Wolf 08/18/25, 07:12 updated 11/13/26, 18:01

Description

In multi site installations you want to have different mail settings, for example different SMTP settings depending on what site mail was sent from.

Currently this can only be achieved by doing something like

if (
    isset($_SERVER['SERVER_NAME']) &&
    (
        $_SERVER['SERVER_NAME'] === 'example.org'
        || $_SERVER['SERVER_NAME'] === 'www.example.org'
    )
) {
    $customChanges['MAIL'] = [
        'defaultMailFromAddress' => 'mysite@example.org',
        'transport' => 'smtp',
        'transport_smtp_server' => 'mail.example.org:587',
        'transport_smtp_encrypt' => false, 
    ];
}

Which would not work, for example from a command or the backend

Or by fetching specially configured mailers from the transport factory in all places where you send mails, for example:

$mySiteMailer = $transportFactory->get($mailSiteSettings);
$mySiteMailer->send($email);

As this is a common use case I think it would be wise to have this build in, maybe with a fall back to a system site solution if not in a site context.

Within commands it would be good if it was possible to set the site I want to sent the mail from on the mailer somehow, maybe in the send method to not introduce additional state.

Reviews 4

History 511

  1. Oliver Hader commented <span data-processor="relativetime" data-value="2026-02-05T21:01:44+00:00" > 02/05/26, 21:01 </span>

    I could imagine having something like this:

    In settings.php

    $GLOBALS['TYPO3_CONF_VARS']['MAIL']['Profiles'] = [
      'default => [
        'transport' => 'sendmail',
        'transport_smtp_server' => 'localhost:25',
        'transport_smtp_encrypt' => false,
        ...
      ],
      'other => [
        'transport' => 'sendmail',
        'transport_smtp_server' => 'localhost:25',
        'transport_smtp_encrypt' => false,
        ...
      ],
    ];

    The site configuration then would only have to reference to an existing “profile”.

  2. Markus Klein commented <span data-processor="relativetime" data-value="2026-07-29T09:18:31+00:00" > 07/29/26, 09:18 </span>

    Last comment from gerrit can be disregarded, this was a copy paste mistake from my side.