Skip to content

Commit

Permalink
Merge pull request #138 from nextcloud/fix/imap_starttls
Browse files Browse the repository at this point in the history
🐛 FIX: starttls support for IMAP over curl
  • Loading branch information
violoncelloCH authored Apr 10, 2020
2 parents 0539b5e + b5799d9 commit 853269b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 853269b

Please sign in to comment.