在电子邮件上设置删除标志,IMAP 收件箱中没有任何反应

发布于 2024-12-04 09:13:11 字数 3011 浏览 0 评论 0原文

我通过 IMAP 连接到网络邮件 (Exchange 2003)。

我使用 mailbee 中的库来执行此操作。

我读完一封邮件后希望将其删除。我的问题是它从未从我的邮箱中删除。

所以我的问题是,Exchange 中是否有某些设置必须允许“外部”用户删除邮件?

    foreach (MailMessage msg in msgs)
    {
        if (msg.HasAttachments)
        {

            foreach (Attachment attach in msg.Attachments)
            {
                // Save the attachment to the file.
                if (Path.GetExtension(attach.Filename).CompareTo(".csv") == 0)
                {
                    path = localFolder + "\\" + attach.Filename;
                    Console.WriteLine("Saved file: " + path);
                    attach.Save(@path, true);

                    paths.Add(path);

                    //deletes the message
                    imp.DeleteMessages(msg.IndexOnServer.ToString(), false);
                    Console.WriteLine("file nr:" + msg.IndexOnServer);
                }
                else
                {
                    Console.WriteLine("Found a different file: " + attach.Filename);
                }
            }

        }
    }

    DbHandler.Add(paths, backupMonths * -1);                

    return true;
}
catch (Exception e)
{
    Console.Out.WriteLine(e);
    return false;
}

这是 MailBee 库的连接日志,

[22:02:18.41] [RECV] Received: from BL2PRD0103MB072.prod.exchangelabs.com ([169.254.7 ... 004_7708CE53FE258F4B9804719502D521C4076B23BL2PRD0103MB072pr_--\r\n [Literal of length 173705.]
[22:02:18.41] [RECV]  FLAGS (\Seen \Deleted))\r\n [Total 173784 bytes received.]
[22:02:18.80] [RECV] * 7 FETCH (UID 8 RFC822.SIZE 126633 BODY[] {173862}\r\n
[22:02:18.80] [RECV] Received: from BL2PRD0103MB072.prod.exchangelabs.com ([169.254.7 ... 004_7708CE53FE258F4B9804719502D521C4076B11BL2PRD0103MB072pr_--\r\n [Literal of length 173862.]
[22:02:18.81] [RECV]  FLAGS (\Seen \Deleted))\r\n [Total 173941 bytes received.]
[22:02:18.81] [RECV] MBN00000004 OK FETCH completed.\r\n [Total 33 bytes received.]
[22:02:18.81] [INFO] Envelopes downloaded
[22:02:18.92] [INFO] Setting flags for messages.
[22:02:18.92] [SEND] MBN00000005 STORE 5 +FLAGS.SILENT (\Deleted)\r\n
[22:02:19.07] [RECV] MBN00000005 OK STORE completed.\r\n [Total 33 bytes received.]
[22:02:19.09] [INFO] Setting flags for messages.
[22:02:19.09] [SEND] MBN00000006 STORE 6 +FLAGS.SILENT (\Deleted)\r\n
[22:02:19.24] [RECV] MBN00000006 OK STORE completed.\r\n [Total 33 bytes received.]
[22:02:19.25] [INFO] Setting flags for messages.
[22:02:19.25] [SEND] MBN00000007 STORE 7 +FLAGS.SILENT (\Deleted)\r\n
[22:02:19.40] [RECV] MBN00000007 OK STORE completed.\r\n [Total 33 bytes received.]
[22:02:35.67] [SEND] MBN00000008 LOGOUT\r\n
[22:02:35.82] [RECV] * BYE Microsoft Exchange Server 2010 IMAP4 server signing off.\r\n [Total 64 bytes received.]
[22:02:35.82] [RECV] MBN00000008 OK LOGOUT completed.\r\n [Total 34 bytes received.]

我认为这应该设置和删除消息。有人对出了什么问题有任何意见吗?

Im connecting to a webmail (Exchange 2003) via IMAP.

Im using a library from mailbee to do this.

After i'v read a mail I whant it to be deleted. My problem is that it's never removed from my mailbox.

So my question is this, is there some setting in Exchange where you have to allow "external" users to delete messages?

    foreach (MailMessage msg in msgs)
    {
        if (msg.HasAttachments)
        {

            foreach (Attachment attach in msg.Attachments)
            {
                // Save the attachment to the file.
                if (Path.GetExtension(attach.Filename).CompareTo(".csv") == 0)
                {
                    path = localFolder + "\\" + attach.Filename;
                    Console.WriteLine("Saved file: " + path);
                    attach.Save(@path, true);

                    paths.Add(path);

                    //deletes the message
                    imp.DeleteMessages(msg.IndexOnServer.ToString(), false);
                    Console.WriteLine("file nr:" + msg.IndexOnServer);
                }
                else
                {
                    Console.WriteLine("Found a different file: " + attach.Filename);
                }
            }

        }
    }

    DbHandler.Add(paths, backupMonths * -1);                

    return true;
}
catch (Exception e)
{
    Console.Out.WriteLine(e);
    return false;
}

This is what is log for the connection from the MailBee library

[22:02:18.41] [RECV] Received: from BL2PRD0103MB072.prod.exchangelabs.com ([169.254.7 ... 004_7708CE53FE258F4B9804719502D521C4076B23BL2PRD0103MB072pr_--\r\n [Literal of length 173705.]
[22:02:18.41] [RECV]  FLAGS (\Seen \Deleted))\r\n [Total 173784 bytes received.]
[22:02:18.80] [RECV] * 7 FETCH (UID 8 RFC822.SIZE 126633 BODY[] {173862}\r\n
[22:02:18.80] [RECV] Received: from BL2PRD0103MB072.prod.exchangelabs.com ([169.254.7 ... 004_7708CE53FE258F4B9804719502D521C4076B11BL2PRD0103MB072pr_--\r\n [Literal of length 173862.]
[22:02:18.81] [RECV]  FLAGS (\Seen \Deleted))\r\n [Total 173941 bytes received.]
[22:02:18.81] [RECV] MBN00000004 OK FETCH completed.\r\n [Total 33 bytes received.]
[22:02:18.81] [INFO] Envelopes downloaded
[22:02:18.92] [INFO] Setting flags for messages.
[22:02:18.92] [SEND] MBN00000005 STORE 5 +FLAGS.SILENT (\Deleted)\r\n
[22:02:19.07] [RECV] MBN00000005 OK STORE completed.\r\n [Total 33 bytes received.]
[22:02:19.09] [INFO] Setting flags for messages.
[22:02:19.09] [SEND] MBN00000006 STORE 6 +FLAGS.SILENT (\Deleted)\r\n
[22:02:19.24] [RECV] MBN00000006 OK STORE completed.\r\n [Total 33 bytes received.]
[22:02:19.25] [INFO] Setting flags for messages.
[22:02:19.25] [SEND] MBN00000007 STORE 7 +FLAGS.SILENT (\Deleted)\r\n
[22:02:19.40] [RECV] MBN00000007 OK STORE completed.\r\n [Total 33 bytes received.]
[22:02:35.67] [SEND] MBN00000008 LOGOUT\r\n
[22:02:35.82] [RECV] * BYE Microsoft Exchange Server 2010 IMAP4 server signing off.\r\n [Total 64 bytes received.]
[22:02:35.82] [RECV] MBN00000008 OK LOGOUT completed.\r\n [Total 34 bytes received.]

I think this should set and delete the messages. Anyone got any inputs on whats wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文