TYPO3: Custom backend login logo prevents mail sending
A bug in the TYPO3 core causes that the mail dispatch does not work anymore if you set an individual logo for the backend login.
This error message appears:
Could not deliver mail Please verify $GLOBALS['TYPO3_CONF_VARS']['MAIL'][*] settings are valid.
The following solutions can help to work around this bug:
Provide logo outside the /fileadmin/
Provide the logo in public folder
Adjusting the loginLogo-path
If you use the path with the extensions directory like EXT:my_extension/... then it works for sending emails, but not for the login form.
If you want to get the login form and the mail function working at the same time, you have to use the domain name and specify the path as follows:
//www.domain.com/path/to/logo.svg (without http: or https:)
However, there are situations where you don't want to have the domain name in the LocalConfiguration.php. For a more dynamic variant we have to edit the file /typo3conf/LocalConfiguration.php and insert the PHP variable $_SERVER['HTTP_HOST'] instead of the domain.
return [
'EXTENSIONS' => [
'backend' => [
'loginLogo' => '//'.$_SERVER['HTTP_HOST'].'/typo3conf/ext/extensionName/Resources/Public/Images/logo.svg',
],
],
]
But with this code we get a PHP Notice from composer:
PHP Notice: Undefined index: HTTP_HOST in ../typo3conf/LocalConfiguration.php
We can work around this notice by modifying the code as follows:
if(isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])){
$currentHost = $_SERVER['HTTP_HOST'];
}else{
$currentHost = "www.domain.com"; // Here we specify a domain in case something like Composer accesses the file.
}
return [
'EXTENSIONS' => [
'backend' => [
'loginLogo' => '//'.$currentHost.'/typo3conf/ext/extensionName/Resources/Public/Images/logo.svg',
],
],
]
Were we able to help you?
Did this article help you?
We would be happy to receive your feedback!