From 4a2f4fdadc3cafadf670a580f74bab3986b17c1e Mon Sep 17 00:00:00 2001 From: FreeScout Date: Thu, 16 Nov 2023 21:56:58 -0800 Subject: [PATCH] Allow to set SMTP timeout via MAIL_TIMEOUT .env parameter --- config/mail.php | 9 +++++++++ .../framework/src/Illuminate/Mail/TransportManager.php | 3 +++ 2 files changed, 12 insertions(+) diff --git a/config/mail.php b/config/mail.php index c1def1e1d..781294898 100644 --- a/config/mail.php +++ b/config/mail.php @@ -120,4 +120,13 @@ ], ], + /* + |-------------------------------------------------------------------------- + | Swiftmailer SMTP timeout. + |-------------------------------------------------------------------------- + | + */ + + 'timeout' => env('MAIL_TIMEOUT', 30), + ]; diff --git a/overrides/laravel/framework/src/Illuminate/Mail/TransportManager.php b/overrides/laravel/framework/src/Illuminate/Mail/TransportManager.php index 36de2b41e..2ed34ac43 100644 --- a/overrides/laravel/framework/src/Illuminate/Mail/TransportManager.php +++ b/overrides/laravel/framework/src/Illuminate/Mail/TransportManager.php @@ -53,6 +53,9 @@ protected function createSmtpDriver() $transport->setStreamOptions($config['stream']); } + // SMTP Timeout. + $transport->setTimeout(config('mail.timeout')); + return $transport; }