IMAP moved message not being deleted.

When calling the IMAP component's MoveToMailbox method, the message is copied to the new folder, and the original message is marked with the "\Deleted" flag. At this point, however, the message will still be contained in the folder until it is expunged.

Depending on server settings, this may happen at a predetermined time interval, when the user logs off, or not at all. In this case, the ExpungeMailbox method can be used to force the mailbox to be expunged.

imap1.Mailbox = "\"INBOX\""; imap1.SelectMailbox(); imap1.MessageSet = messageIndex.ToString(); imap1.Mailbox = "\"NewMailbox\""; imap1.MoveToMailbox(); // Remove all message marked with "\Deleted" flag imap1.ExpungeMailbox();

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at