本文介绍了将电子邮件标记为PHP IMAP中未读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有任何 PHP IMAP 函数可用于标记电子邮件如未读?我正在使用一些IMAP函数检查邮件,这些函数会将邮件返回为已读状态,但我想使其不被读取.
Are there any PHP IMAP functions which can be used to mark an email as unread? I am checking the mail using some IMAP functions that return the messages as read, but I want to make them unread.
推荐答案
要将电子邮件标记为未读,应在该消息上取消设置\\Seen
标志.
您可以使用 imap_clearflag_full
函数清除消息标志
To mark an email message as unread, you should unset the \\Seen
flag on that message.
You could 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);
注意:
您可以在阅读邮件时设置FT_PEEK
标志,如果尚未设置,则不会设置\\Seen
标志.
You can set the FT_PEEK
flag when reading messages, this will not set the \\Seen
flag if not already set.
// This will not mark a message as seen
$body = imap_body($imap_stream, $msg_number, FT_PEEK);
这篇关于将电子邮件标记为PHP IMAP中未读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!