开发者

Setting the delete flag on email, nothing happens in IMAP inbox

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.IndexOnServe开发者_开发知识库r);
                }
                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?


According to the documentation with sample code of Mailbee regarding DeleteMessages you need a call to imp.Close() before calling imp. Disconnect() - otherwise the messages won't get purged.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜