如何将我的电子邮件标记为已读或已在php中看到?

时间:2019-05-06 18:19:15

标签: php email imap

我正在使用我的php代码将我的电子邮件标记为已读或已看到。我知道那里有很多答案,我做了很多Google搜索,并且尝试使用每种不同的代码,但是不幸的是,它对我不起作用。当我尝试使用每个不同的代码时,它不会将我的电子邮件标记为已读或可见。它只能将我的电子邮件标记为未读或在我使用imap_clearflag_full($inbox, $email_number, "\\Seen");时看不到。

这是到目前为止我已经尝试过的内容:

imap_clearflag_full($inbox, $email_number, "\\Seen");
imap_clearflag_full($inbox, $email_number, "\\UnSeen");
imap_clearflag_full($inbox, $email_number, "\\UNSEEN");
imap_clearflag_full($inbox, $email_number, "\\Seen \\Recent");

我已经尝试过了:

imap_clearflag_full($inbox, $email_number, "\\Seen", ST_UID);

这是完整的代码:

<?php
require_once "Mail.php";
require_once('Mail/IMAPv2.php');

$username = 'myusername';
$password = 'mypassword';
$mailbox = '{imap.example.com:993/imap/ssl/novalidate-cert}INBOX';
$email_number= '236';

$inbox = imap_open($mailbox, $username, $password) or die("Can't connect: " . imap_last_error());

if (PEAR::isError($inbox)) {
    echo "<span style='font-weight: bold;'>Error:</span> Unable to build a connection.";
}
else
{
    imap_clearflag_full($inbox, $email_number, "\\Seen \\Recent");
    echo "mailbox have been marked as read";
}
imap_expunge($inbox);
imap_close($inbox);
?>

我希望做的是将我的电子邮件标记为已读或已读。我已经尝试了一切,但不知道该怎么办。

您能给我看一个示例代码,如何将我的电子邮件标记为已读或已看到吗?

谢谢。

0 个答案:

没有答案