Merge pull request #138 from nextcloud/fix/imap_starttls

🐛 FIX: starttls support for IMAP over curl
This commit is contained in:
violoncello.ch
2020-04-10 15:36:47 +02:00
committed by GitHub

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);