From 7ef052326ef31e37ded49612e5237a4f0d351e65 Mon Sep 17 00:00:00 2001 From: "Mohammad Reza Tayyebi (on Dell Latitude)" Date: Thu, 1 Jan 2026 18:23:31 +0400 Subject: [PATCH] refactor: remove dead code in smtp_api (auth always required) --- data/web/inc/functions.inc.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 44a483c39..5c72f6d49 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -3622,18 +3622,14 @@ function smtp_api($action, $data) { $mail->CharSet = 'UTF-8'; $mail->XMailer = 'mailcow SMTP API'; - // Enable authentication if password is provided - if (!empty($smtp_pass)) { - $mail->SMTPAuth = true; - $mail->Username = $smtp_user; - $mail->Password = $smtp_pass; - if ($smtp_port == 465) { - $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; - } elseif ($smtp_port == 587) { - $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; - } - } else { - $mail->SMTPAuth = false; + // Authentication is required + $mail->SMTPAuth = true; + $mail->Username = $smtp_user; + $mail->Password = $smtp_pass; + if ($smtp_port == 465) { + $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; + } elseif ($smtp_port == 587) { + $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; } // Set sender