]> git.agnieray.net Git - galette.git/commitdiff
Fix gatreway timeout sending emails with SSL SMTP; closes #1591
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 6 Nov 2021 05:46:43 +0000 (06:46 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sat, 6 Nov 2021 05:46:43 +0000 (06:46 +0100)
galette/lib/Galette/Core/GaletteMail.php

index aade92b38c668686310ff7e331b64bd11fdb9fae..e304517a00647778b20a4049e9babcfd06c43ec2 100644 (file)
@@ -135,7 +135,6 @@ class GaletteMail
                 } else {
                     $this->mail->Host = $this->preferences->pref_mail_smtp_host;
                     $this->mail->SMTPAuth   = $this->preferences->pref_mail_smtp_auth;
-                    $this->mail->SMTPSecure = $this->preferences->pref_mail_smtp_secure;
 
                     if (!$this->preferences->pref_mail_smtp_secure || $this->preferences->pref_mail_allow_unsecure) {
                         //Allow "unsecure" SMTP connections if user has asked fot it or
@@ -161,7 +160,13 @@ class GaletteMail
                             ']No SMTP port provided. Switch to default (25).',
                             Analog::INFO
                         );
-                        $this->mail->Port = 25;
+                        $this->mail->Port = $this->preferences->pref_mail_smtp_secure ? 587 : 25;
+                    }
+
+                    if ($this->preferences->pref_mail_smtp_secure && $this->mail->Port == 465) {
+                        $this->mail->SMTPSecure = "ssl";
+                    } elseif ($this->preferences->pref_mail_smtp_secure && $this->mail->Port == 587) {
+                        $this->mail->SMTPSecure = "tls";
                     }
                 }