Skip to content

Commit b5799d9

Browse files
committed
🐛 FIX: starttls support for IMAP over curl
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
1 parent 0539b5e commit b5799d9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/imap.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ public function checkPassword($uid, $password) {
8585
$groups[] = $pieces[1];
8686
}
8787

88-
$protocol = $this->sslmode ? "imaps" : "imap";
88+
$protocol = ($this->sslmode === "ssl") ? "imaps" : "imap";
8989
$url = "{$protocol}://{$this->mailbox}:{$this->port}";
9090
$ch = curl_init();
91+
if ($this->sslmode === 'tls') {
92+
curl_setopt($ch, CURLOPT_USE_SSL, CURLUSESSL_ALL);
93+
}
9194
curl_setopt($ch, CURLOPT_URL, $url);
9295
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
9396
curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);

0 commit comments

Comments
 (0)