Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mark mail as unread

Tags:

php

email

imap

How do I mark a email as unread? I know I can open the stream as read only, but on some occasions I need to manipulate the message (mark as seen, move to a different folder, etc.), so I need the stream to be read/write. I also know about the "Seen" flag and how to remove it.

So is there a way to mark an email as unread after it has been marked as read?

Here is the code which is removing the 'Seen' flag from the mail:

imap_clearflag_full($this->mbox, $mId, '\\Seen', ST_UID);
like image 892
clang1234 Avatar asked Dec 22 '25 14:12

clang1234


1 Answers

This works for Gmail, verified:

imap_clearflag_full($mbox, $i, "\\Seen \\Recent");
imap_expunge($mbox);
like image 146
I wrestled a bear once. Avatar answered Dec 24 '25 02:12

I wrestled a bear once.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!