Archived Forum Post

Index of archived forum posts


Moving messages from one mailbox to another

Mar 31 '14 at 14:24


How can I move messages from one mailbox to another? For example, from Inbox to CustomFolder. I use next code for this:

            foreach (int uid in args.Uids)
                if (_imap.Copy(uid, true, args.ToFolder))
                    _imap.SetFlag(uid, true, "Deleted", 1);

            if (copied.Count > 0)

I didn't find any method for moving.

Accepted Answer

The IMAP protocol itself does not provide a "MOVE to another folder" command. The only way to do it is to copy the email to another folder, and then delete it from the original folder.