Email tag unread in PHP IMAP

Are there any PHP IMAP features that can be used to mark a message as unread? I check mail using some IMAP functions that return messages as read, but I want to make them unread.

+4
source share
3 answers

try imap_clearflag_full, http://php.net/manual/en/function.imap-clearflag-full.php

imap_clearflag_full ($ mailbox, $ email_number, "\\ Seen");

+2
source

To mark an email message as unread, you must disable the \Seen flag in this message.
You can use the imap_clearflag_full function to clear message flags.

 // Unset desired flag imap_clearflag_full($imap_connection, $message_number, "//Seen"); // Confirm changes imap_close($imap_connection, CL_EXPUNGE); 

Note:

"I check mail using some IMAP functions that return messages as read"

You can set the FT_PEEK flag when reading messages, this will not set the \Seen flag if it is not already set.

 // This will not mark a message as seen $body = imap_body($imap_stream, $msg_number, FT_PEEK); 
+2
source

Source: https://habr.com/ru/post/1438797/


All Articles