php - 如何在 php 中将我的电子邮件标记为已读或已查看?
问题描述
我正在编写我的 php 代码以将我的电子邮件标记为已读或已查看。我知道那里有很多答案,我做了很多谷歌搜索,我尝试使用每个不同的代码,但不幸的是它对我不起作用。当我尝试使用每个不同的代码时,它不会将我的电子邮件标记为已读或已查看。它只能在我使用时将我的电子邮件标记为未读或未查看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);
?>
我期望做的是将我的电子邮件标记为已读或已查看。我已经尝试了一切,我不知道该怎么做。
您能否向我展示一个示例代码,如何将我的电子邮件标记为已读或已查看?
谢谢你。
解决方案
推荐阅读
- django - 为什么 Docker Django 管理员因代码 245 崩溃
- autodesk-forge - Autodesk Forge 如何保存和显示标记
- javascript - 参考错误。如何从 json 数组定义变量?
- python - “模块”对象不可拼合
- html - 在画布上动画绘制 arcTo 线
- ios - @State 错误我位于导航栏的 TextField - SwiftUI
- typescript - 在打字稿中将对象类型分配给数组值
- go - Golang 括号语法解释
- c# - mysql dataSource使用带有IN子句的select从参数中删除引号
- javascript - 将 webSDK 与 jQuery Inside Vue 组件集成?