Skip to content

Commit 7ef0523

Browse files
committed
refactor: remove dead code in smtp_api (auth always required)
1 parent e63e902 commit 7ef0523

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

data/web/inc/functions.inc.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,18 +3622,14 @@ function smtp_api($action, $data) {
36223622
$mail->CharSet = 'UTF-8';
36233623
$mail->XMailer = 'mailcow SMTP API';
36243624

3625-
// Enable authentication if password is provided
3626-
if (!empty($smtp_pass)) {
3627-
$mail->SMTPAuth = true;
3628-
$mail->Username = $smtp_user;
3629-
$mail->Password = $smtp_pass;
3630-
if ($smtp_port == 465) {
3631-
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
3632-
} elseif ($smtp_port == 587) {
3633-
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
3634-
}
3635-
} else {
3636-
$mail->SMTPAuth = false;
3625+
// Authentication is required
3626+
$mail->SMTPAuth = true;
3627+
$mail->Username = $smtp_user;
3628+
$mail->Password = $smtp_pass;
3629+
if ($smtp_port == 465) {
3630+
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
3631+
} elseif ($smtp_port == 587) {
3632+
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
36373633
}
36383634

36393635
// Set sender

0 commit comments

Comments
 (0)