From 886c3097531ed4a7b9fe310b81dfddb56aacf2a6 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Fri, 16 Feb 2024 14:13:15 +0000 Subject: [PATCH] fixes #3658 Closes #3658 Merge request studip/studip!2616 --- config/config_defaults.inc.php | 2 +- lib/bootstrap.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config_defaults.inc.php b/config/config_defaults.inc.php index e9ac59eab4a..4a362ad0d9f 100644 --- a/config/config_defaults.inc.php +++ b/config/config_defaults.inc.php @@ -199,7 +199,7 @@ $MAIL_TRANSPORT = "smtp"; ---------------------------------------------------------------- leave blank or try 127.0.0.1 if localhost is also the mailserver ignore if you don't use smtp as transport*/ -$MAIL_HOST_NAME = ""; //which mailserver should we use? (must allow mail-relaying from $MAIL_LOCALHOST, defaults to SERVER_NAME) +$MAIL_HOST_NAME = ""; //which mailserver should we use? (must allow mail-relaying from $MAIL_LOCALHOST, defaults to localhost) $MAIL_SMTP_OPTIONS = [ 'port' => 25, 'user' => '', diff --git a/lib/bootstrap.php b/lib/bootstrap.php index e546d05404d..42c4f418e49 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -269,8 +269,8 @@ $mail_transporter_class = $mail_transporter_name . '_class'; $mail_transporter = new $mail_transporter_class; if ($mail_transporter_name == 'smtp_message') { include 'vendor/email_message/smtp.php'; - $mail_transporter->localhost = ($GLOBALS['MAIL_LOCALHOST'] == "") ? $_SERVER["SERVER_NAME"] : $GLOBALS['MAIL_LOCALHOST']; - $mail_transporter->smtp_host = ($GLOBALS['MAIL_HOST_NAME'] == "") ? $_SERVER["SERVER_NAME"] : $GLOBALS['MAIL_HOST_NAME']; + $mail_transporter->localhost = $GLOBALS['MAIL_LOCALHOST'] ?: $_SERVER['SERVER_NAME']; + $mail_transporter->smtp_host = $GLOBALS['MAIL_HOST_NAME'] ?: 'localhost'; if (is_array($GLOBALS['MAIL_SMTP_OPTIONS'])) { foreach ($GLOBALS['MAIL_SMTP_OPTIONS'] as $key => $value) { $mail_transporter->{"smtp_$key"} = $value; -- GitLab