From e7e62a38c8bd15bc52b31a04c6b4595df5ec3cc4 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 17 Oct 2024 09:55:58 +0200 Subject: [PATCH] fix: increase default SMTP timeout Signed-off-by: Anna Larch --- doc/admin.md | 2 +- lib/SMTP/SmtpClientFactory.php | 2 +- tests/Unit/SMTP/SmtpClientFactoryTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/admin.md b/doc/admin.md index d85b17efee..9f64f15383 100644 --- a/doc/admin.md +++ b/doc/admin.md @@ -40,7 +40,7 @@ Depending on your mail host, it may be necessary to increase your IMAP and/or SM ``` #### SMTP timeout ```php -'app.mail.smtp.timeout' => 2 +'app.mail.smtp.timeout' => 20 ``` #### Sieve timeout ```php diff --git a/lib/SMTP/SmtpClientFactory.php b/lib/SMTP/SmtpClientFactory.php index 2a2d954254..3d63195fba 100644 --- a/lib/SMTP/SmtpClientFactory.php +++ b/lib/SMTP/SmtpClientFactory.php @@ -60,7 +60,7 @@ public function create(Account $account): Horde_Mail_Transport { 'port' => $mailAccount->getOutboundPort(), 'username' => $mailAccount->getOutboundUser(), 'secure' => $security === 'none' ? false : $security, - 'timeout' => (int)$this->config->getSystemValue('app.mail.smtp.timeout', 5), + 'timeout' => (int)$this->config->getSystemValue('app.mail.smtp.timeout', 20), 'context' => [ 'ssl' => [ 'verify_peer' => $this->config->getSystemValueBool('app.mail.verify-tls-peer', true), diff --git a/tests/Unit/SMTP/SmtpClientFactoryTest.php b/tests/Unit/SMTP/SmtpClientFactoryTest.php index 923ac45231..456cb0c98f 100644 --- a/tests/Unit/SMTP/SmtpClientFactoryTest.php +++ b/tests/Unit/SMTP/SmtpClientFactoryTest.php @@ -70,7 +70,7 @@ public function testSmtpTransport() { ->willReturnMap([ ['app.mail.transport', 'smtp', 'smtp'], ['debug', false, false], - ['app.mail.smtp.timeout', 5, 2], + ['app.mail.smtp.timeout', 20, 2], ]); $this->config->expects($this->any()) ->method('getSystemValueBool')