使用 IMAP 删除邮件并不会从 MailSystem.NET 中删除邮件
我正在使用 MailSystem.NET 操作系统库来处理 IMAP。我的客户端程序(用 C# 编写)有问题。它使用 IMAP 库轮询邮件服务器。将消息添加到客户端数据库后,它将消息标记为已删除。但是,我不一定要物理删除电子邮件,因为其他客户端将无法阅读该电子邮件。
所以我调用DeleteMessage(1, false),它应该将电子邮件标记为已删除,但由于“expunge”设置为 false,因此它不会从服务器中物理删除。
如果我打开 Thunderbird(另一个客户端)并连接到邮箱,那么邮件肯定已经消失了。然而,我的另一个客户看到该消息仍然存在。邮件计数显示 1。如何确保当我从“收件箱”邮件文件夹返回邮件计数时,它仅返回那些未标记为删除的邮件,即那些尚未被客户端程序读取的邮件?
I'm using the MailSystem.NET OS library for handling IMAP. I have a problem with my client program (written in c#). It polls the mail server using the IMAP library. It marks a message as deleted after adding it into the client db. However, I don't necessarily want to remove the email physically as other clients won't be able to read the email.
So I call DeleteMessage(1, false), which should MARK the email as deleted but since 'expunge' is set false it is not physically removed from the server.
If I open Thunderbird (a different client) and connect to the mailbox, sure enough the message has gone. However, my other client sees the message as still there. The message count shows 1. How do I make sure that when I return the message count from the 'INBOX' mail folder it only returns those that are not marked for deletion, i.e. those that have not already been read by the client program?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 Ivar 在他的评论中提到的,您可以使用 UNDELETED 来搜索邮箱中的邮件。然而,我发现“NOT DELETED”搜索标志在我一直使用的 IMAP 库上工作得更好。
As Ivar mentioned in his comment, you can use UNDELETED to search the mailbox for messages. However, I found the "NOT DELETED" search flag to work better on the IMAP library I have been using.