doujiling4377 2019-05-06 18:19
浏览 368

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

I am working on my php code to mark my email as read or seen. I understand that there is alot of answers out there, I have did alot of google search and I have tried to use each different codes, but unfortunately it did not work for me. It will not mark my email as read or seen when I tried to use each different codes. It can only mark my emails as Unread or not seen when I use imap_clearflag_full($inbox, $email_number, "\\Seen");.

Here is what I have already tried so far:

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");

And I have already tried this:

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

Here is the full code:

<?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);
?>

What I expect to do is to mark my emails as read or seen. I have tried everything and I don't know what to do.

Can you please show me an example code how I could mark my emails as read or seen?

Thank you.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 孟德尔随机化结果不一致
    • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法