Issue Task Accepted Orphaned Good first issue

#104329Do not use no-reply@example.com email addres as a fallback for the defaultMailFromAddress

Marcin Sągol 07/07/24, 11:24 updated 04/20/25, 15:10

Description

The typo3/cms-core/Classes/Utility/MailUtility.php class offers helper methods to fetch several configuration values related to making, providing also some fallbacks.

One of them is this method:

public static function getSystemFromAddress(): string
{
    $address = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] ?? null;

    if (!is_string($address) || !GeneralUtility::validEmail($address)) {
        // still nothing, get host name from server
        $address = 'no-reply@' . php_uname('n');
        if (!GeneralUtility::validEmail($address)) {
            // if everything fails use a dummy address
            $address = 'no-reply@example.com';
        }
    }
    return $address;
}

So, here as a very last fallback we have the no-reply@example.com used which might not be a good idea as it can expose some sensitive data.
It should be considered if this fallback should be used and even if the php_uname usage is intended.
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'], just throw some exception.

Reviews 1

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". The changes above were merged or abandoned: read them before you start. How to create a patch

Commit message
[TASK] Do not use no-reply@example.com email addres as a fallback for the defaultMailFromAddress Resolves: #104329 Releases: main