php-imap-client
php-imap-client copied to clipboard
setUnseenMessage() true or false does the same thing
Hi
$imap->setUnseenMessage(1, $seen = true); and $imap->setUnseenMessage(1, $seen = false);
sets the message as unread. Also whats the difference between id and uid?
This dont seem to work with uid's
You must use the id. UID and IDS are both used differently by php. Fixing this now..
setUnseenMessage ONLY can set the message as seen. It cannot set the unseen flag according to here and here.
Why does it require the boolean value than? There should be a setSeenMessage() than.
But personal I would prefer one method that did both.
It does not require the boolean. The docs are incorrect which I will fix. We cannot set a message as seen as you can read above. The only way I can think to read a message without the stay unread modifier we apply. What do you think?
Also setUnseenMessage would be renamed if it had two functions. How about setMessageSeenState?
setUnseenMessage Is perfect. I'm haven't got much programming experience so cant comment on how its done. Only 17 :)
Well let's not go into age here :) (Just know im wayy younger than you think. Younger than you.. ) Anyways I think that way will work. I will begin testing this and ill commit it later :)
Ah but I'm a nub too. just started PHP this year :)
Ah :) Started about 2 :). Anyhow my method seems to be the best I can find
- This method setUnseenMessage($ids) is a wrapper for this imap_clearflag_full(). So he returns boolean. More details here http://php.net/manual/en/function.imap-clearflag-full.php
Return Values Returns TRUE on success or FALSE on failure.
/**
* Delete flag message SEEN
*
* @param int $ids or string like 1,2,3,4,5 or string like 1:5
* @return bool
*/
public function setUnseenMessage($ids)
{
// We need better docs for this
return imap_clearflag_full($this->imap, $ids, "\\Seen");
}
- About ID and UID.
You have an INBOX folder on the mail server. When a message arrives there, it is marked as ID = 1 and UID = unikid9238, when the next letter comes it is marked as ID = 1 and UID = unicid9239, and the previous letter is changed to ID = 2. Thus, the ID of the letter in the current folder is CHANGED, and the letter UID in the current folder is NOT CHANGED. BUT when moving a letter from a folder such as INBOX to a folder for example SENT, it changes both the ID and the UID.
Now the given library allows to work correctly only with the ID.
This library is a wrapper over standard built-in functions in PHP. You can see it here. http://php.net/manual/en/book.imap.php
- Well, you have everything ahead of you. Study the protocols of interaction between servers and clients, for example imap-server and the php. Read more php.net, and everything will be ok.
Hi, to mark as seen email you should try imap_setflag_full, I'm a newbie in programing, and I don't speak English. I added the second function and works for me!
public function setUnseenMessage($ids)
{
// We need better docs for this
return imap_clearflag_full($this->imap, $ids, "\\Seen");
}
public function setReadMessage($ids)
{
return imap_setflag_full($this->imap, $ids, "\\Seen");
}
I will deff check this out.