From b5799d90b897ac91f5c8a087efd340a6f473d8f9 Mon Sep 17 00:00:00 2001 From: Jonas Sulzer Date: Thu, 9 Apr 2020 21:54:35 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20starttls=20support=20for?= =?UTF-8?q?=20IMAP=20over=20curl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonas Sulzer --- lib/imap.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/imap.php b/lib/imap.php index 7a83f14..da6089d 100644 --- a/lib/imap.php +++ b/lib/imap.php @@ -85,9 +85,12 @@ public function checkPassword($uid, $password) { $groups[] = $pieces[1]; } - $protocol = $this->sslmode ? "imaps" : "imap"; + $protocol = ($this->sslmode === "ssl") ? "imaps" : "imap"; $url = "{$protocol}://{$this->mailbox}:{$this->port}"; $ch = curl_init(); + if ($this->sslmode === 'tls') { + curl_setopt($ch, CURLOPT_USE_SSL, CURLUSESSL_ALL); + } curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);