Search code examples
emailimapmail-servermailkit

How to move/copy a message to another user's mailbox using MailKit and imap?


I'm creating an automation system which has a catchall mailbox and receives every non-existing email delivered to the mail server.

I then do some tasks based on some of these emails. But sometimes the message must be delivered to one of the existing mailboxes.

My question is, how can I, using the domain's admin account and IMAP protocol, move/copy these messages to the existing mailboxes using the MailKit library?

I think I have figured out this much that the IMAP's MOVE command which maps to ImapClient.Inbox.Move in MailKit, is supposedly meant for this purpose, but what I can't figure out is, how to access the "Complete Hierarchy" namespace on IMAP to find the right user's Inbox folder?


Solution

  • Most IMAP servers sandbox themselves such that your account can't see another user's account.

    I suspect there's no way for even your admin account to see other user's accounts. That would be a massive privacy issue.

    This is, at best, going to be specific to the exact IMAP server software you are using, but I would not expect to be able to do what you want to do.