Skip to content

Commit 7af28d2

Browse files
committed
Using a bit more fail save uid / msgNo by calling imap_msgno()
1 parent b79d44c commit 7af28d2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/IMAP/Client.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ public function setConfig(array $config) {
109109
return $this;
110110
}
111111

112+
/**
113+
* Get the current imap resource
114+
*
115+
* @return resource
116+
*/
117+
public function getConnection(){
118+
return $this->connection;
119+
}
120+
112121
/**
113122
* Set read only property and reconnect if it's necessary.
114123
*

src/IMAP/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ class Message {
128128
* @param $fetch_options
129129
*/
130130
public function __construct($uid, $msglist, Client $client, $fetch_options = null) {
131-
$this->uid = $uid;
132131
$this->msglist = $msglist;
133132
$this->client = $client;
133+
$this->uid = imap_msgno($this->client->getConnection(), $uid);
134134

135135
$this->setFetchOption($fetch_options);
136136
$this->parseHeader();
@@ -258,7 +258,7 @@ private function parseHeader() {
258258
$this->message_id = str_replace(['<', '>'], '', $header->message_id);
259259
}
260260
if (property_exists($header, 'Msgno')) {
261-
$this->message_no = trim($header->Msgno);
261+
$this->message_no = imap_msgno($this->client->getConnection(), trim($header->Msgno));
262262
}
263263
}
264264

0 commit comments

Comments
 (0)