]> git.agnieray.net Git - galette.git/commitdiff
Allow unsecure SMTP connection on some cases
authorJohan Cwiklinski <johan@x-tnd.be>
Mon, 6 Mar 2017 04:25:52 +0000 (05:25 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Mon, 6 Mar 2017 04:25:52 +0000 (05:25 +0100)
Allow "unsecure" SMTP connections if user has asked fot it or
if user did not request TLS explicitely.
Tha "ask for it" UI part is not done yet.

refs #1020

galette/lib/Galette/Core/GaletteMail.php

index 481038be2cdbd98ed4c36f2f79083541b10cc3d6..1c80a04e2b1cdf73dfe9863b87ef35ed334948b7 100644 (file)
@@ -109,6 +109,19 @@ class GaletteMail
                     $this->mail->Host = $preferences->pref_mail_smtp_host;
                     $this->mail->SMTPAuth   = $preferences->pref_mail_smtp_auth;
                     $this->mail->SMTPSecure = $preferences->pref_mail_smtp_secure;
+
+                    if (!$preferences->pref_mail_smtp_secure || $preferences->pref_mail_allow_unsecure) {
+                        //Allow "unsecure" SMTP connections if user has asked fot it or
+                        //if user did not request TLS explicitely
+                        $this->mail->SMTPOptions = array(
+                            'ssl' => array(
+                                'verify_peer' => false,
+                                'verify_peer_name' => false,
+                                'allow_self_signed' => true
+                            )
+                        );
+                    }
+
                     if ($preferences->pref_mail_smtp_port
                         && $preferences->pref_mail_smtp_port != ''
                     ) {