I am trying to move a message to another folder in a mail box using the IMAP functionality of ae.net.mail. The problem is that although the message is moved into the target folder, it is not removed from INBOX.
I'm also having a problem deleting a message. In this case I'm finding that the status of the message merely changes from unseen to seen.
Here is what I have tried:
using (ImapClient ic = new ImapClient(
host, email, password, ImapClient.AuthMethods.Login, 993, true))
{
ic.SelectMailbox("INBOX");
string[] uids = ic.Search(SearchCondition.From("[email protected]"));
MailMessage[] messages =
ic.GetMessages(uids[0], uids[uids.Length - 1], false);
ic.MoveMessage(uids[0], "Junk");
}
IMAP accounts provide several options to delete messages that aren't available in POP accounts. Tools -> Account Settings -> Account Name -> Server Settings -> "When I delete a message" has choices for "Move it to the Trash folder", "Mark it as deleted" and "Remove it immediately".
IMAP stands for Internet Message Access Protocol. This second method, like POP, is used for email retrieval purposes, and starts by accessing email from a remote server. Instead of then storing locally and deleting from the server, the email just simply stays on the server.
Try emptying the Deleted Items folder and then log out. Alternatively, press the Shift key while clicking the Delete button to hard delete your emails. If the issue persists, update and repair Office, run Outlook's Cleanup Tools, and the Inbox Repair Tool.
The standard IMAP protocol does not have a MOVE command (but there is an extension that adds it). So, depending on your IMAP server, the client may need to implement MOVE
as a UID COPY
+ UID STORE +FLAGS.SILENT (\Deleted)
+ UID EXPUNGE
, but that assumes that the server supports the UIDPLUS extension. If the server doesn't support UIDPLUS, either, then it becomes essentially impossible to implement properly. All you can do is COPY
+ STORE +FLAGS.SILENT (\Deleted)
but cannot do the EXPUNGE
because there's no way to limit the messages that will get expunged (I suppose you could unmark any other deleted messages, then EXPUNGE, then re-mark them as \Deleted, but that starts to become risky).
This would explain why the messages might still exist in the INBOX (although they should be at least marked as deleted).
Not sure why marking a message as deleted is marking it as Seen. That seems like a bug in AE.NET.Mail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With