SSilence / php-imap-client

a easy solution for simple IMAP email access in php
MIT License
268 stars 136 forks source link

getMessagesOverview needs to return id #172

Closed abdullahseba closed 7 years ago

abdullahseba commented 7 years ago

Hi agaiiiiiiiiiiiin getMessagesOverview needs to return an id as well as uid its annoooying having to use getId all the time.

mattparksjr commented 7 years ago

According to our latest code in ImapClient.php, getMessagesOverview and getMessageOverview are basically the same thing. So, all we do it get the provided id and call the imap_fetch_overview. This is what returns the uid according to the docs. In order to call these, you need to have the id. I recommend making a php oop class. Like below


use use SSilence\ImapClient\ImapClient;
class Email {

    protected $id;

    public function __construct($id) {
        $imap = new ImapClient;
        $imap->getMessage($id);
        // Set other info provided by get message to a var of this class
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }
}

Then use it like so:

$email = new Email(//put id of message here however you get that);

echo $email->getId();