SSilence / php-imap-client

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

Need a setFlag method #169

Open abdullahseba opened 7 years ago

abdullahseba commented 7 years ago

Hi Is the a method that sets flags? If not could it be added? Thanks.

mattparksjr commented 7 years ago

Hello! This is currently not added! I will begin working on it!

abdullahseba commented 7 years ago

http://php.net/manual/en/function.imap-setflag-full.php

abdullahseba commented 7 years ago

looks like it handles all flags.

reimax commented 6 years ago

in ImapClient.php add:

     /**
     * Set flag message
     *
     * @param int $ids or string like 1,2,3,4,5 or string like 1:5
     * @return bool
     */
    public function setFlagMessage($ids, $flags)
    {
        // We need better docs for this
        return imap_setflag_full($this->imap, $ids, $flags, ST_UID);
    }

    /**
     * Unset flag message
     *
     * @param int $ids or string like 1,2,3,4,5 or string like 1:5
     * @return bool
     */
    public function unsetFlagMessage($ids, $flags)
    {
        // We need better docs for this
        return imap_clearflag_full($this->imap, $ids, $flags, ST_UID);
    }

and use:

$imap->setFlagMessage(message_uid, message_flag);

$imap->unsetFlagMessage(message_uid, message_flag);

default setUnseenMessage() not work since there is no additional option ST_UID. http://php.net/manual/ru/function.imap-clearflag-full.php

mattparksjr commented 6 years ago

Hello. I would be happy to add this code but in order to properly give you credit, I need you to submit a pull request. Would you mind that?

reimax commented 6 years ago

Yes, I'll try. copy the code, this will be enough?

done