🐛 FIX: starttls support for IMAP over curl

Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
This commit is contained in:
Jonas Sulzer
2020-04-09 21:54:35 +02:00
parent 0539b5eca4
commit b5799d90b8

View File

@@ -85,9 +85,12 @@ class OC_User_IMAP extends \OCA\user_external\Base {
$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);