@@ -19,6 +19,7 @@ class SMTP extends EmailAdapter
1919 * @param string $smtpSecure SMTP Secure prefix. Can be '', 'ssl' or 'tls'
2020 * @param bool $smtpAutoTLS Enable/disable SMTP AutoTLS feature. Defaults to false.
2121 * @param string $xMailer The value to use for the X-Mailer header.
22+ * @param int $timeout SMTP timeout in seconds.
2223 */
2324 public function __construct (
2425 private string $ host ,
@@ -28,6 +29,7 @@ public function __construct(
2829 private string $ smtpSecure = '' ,
2930 private bool $ smtpAutoTLS = false ,
3031 private string $ xMailer = '' ,
32+ private int $ timeout = 30
3133 ) {
3234 if (!\in_array ($ this ->smtpSecure , ['' , 'ssl ' , 'tls ' ])) {
3335 throw new \InvalidArgumentException ('Invalid SMTP secure prefix. Must be "", "ssl" or "tls" ' );
@@ -60,6 +62,7 @@ protected function process(EmailMessage $message): array
6062 $ mail ->Password = $ this ->password ;
6163 $ mail ->SMTPSecure = $ this ->smtpSecure ;
6264 $ mail ->SMTPAutoTLS = $ this ->smtpAutoTLS ;
65+ $ mail ->Timeout = $ this ->timeout ;
6366 $ mail ->CharSet = 'UTF-8 ' ;
6467 $ mail ->Subject = $ message ->getSubject ();
6568 $ mail ->Body = $ message ->getContent ();
0 commit comments