Skip to content

Commit 7e46dda

Browse files
Mail: Improve performance by reusing SMTP connections
1 parent deaa468 commit 7e46dda

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

components/ILIAS/Mail/classes/Mime/Transport/class.ilMailMimeTransportSmtp.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ protected function onBeforeSend(): void
3232
$this->mailer->Password = $this->settings->get('mail_smtp_password', '');
3333
}
3434
$this->mailer->SMTPSecure = $this->settings->get('mail_smtp_encryption', '');
35-
$this->mailer->SMTPDebug = 4;
35+
$this->mailer->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_LOWLEVEL;
36+
$this->mailer->SMTPKeepAlive = true;
37+
}
38+
39+
public function __destruct()
40+
{
41+
try {
42+
$this->mailer->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_OFF;
43+
$this->mailer->smtpClose();
44+
} catch (Throwable) {
45+
}
3646
}
3747
}

0 commit comments

Comments
 (0)