From 7af28d2440265fecf54190d5eda4806819191949 Mon Sep 17 00:00:00 2001 From: Webklex Date: Tue, 5 Sep 2017 23:36:36 +0200 Subject: [PATCH] Using a bit more fail save uid / msgNo by calling imap_msgno() --- src/IMAP/Client.php | 9 +++++++++ src/IMAP/Message.php | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/IMAP/Client.php b/src/IMAP/Client.php index 28e775c..0c716dc 100644 --- a/src/IMAP/Client.php +++ b/src/IMAP/Client.php @@ -109,6 +109,15 @@ public function setConfig(array $config) { return $this; } + /** + * Get the current imap resource + * + * @return resource + */ + public function getConnection(){ + return $this->connection; + } + /** * Set read only property and reconnect if it's necessary. * diff --git a/src/IMAP/Message.php b/src/IMAP/Message.php index c5eac0a..666c88c 100644 --- a/src/IMAP/Message.php +++ b/src/IMAP/Message.php @@ -128,9 +128,9 @@ class Message { * @param $fetch_options */ public function __construct($uid, $msglist, Client $client, $fetch_options = null) { - $this->uid = $uid; $this->msglist = $msglist; $this->client = $client; + $this->uid = imap_msgno($this->client->getConnection(), $uid); $this->setFetchOption($fetch_options); $this->parseHeader(); @@ -258,7 +258,7 @@ private function parseHeader() { $this->message_id = str_replace(['<', '>'], '', $header->message_id); } if (property_exists($header, 'Msgno')) { - $this->message_no = trim($header->Msgno); + $this->message_no = imap_msgno($this->client->getConnection(), trim($header->Msgno)); } }