Search code examples
pythonemailsmtpimapmail-server

Is it possible to have two mailboxes(folders) with same name?


I am working on a product where I have to interact with email servers (like zimbra, dovecot etc) through IMAP to fetch emails etc.

I am using Python's imaplib library. I connect to email server account with credentials and then select a mailbox (folder) through its name.

Now I am wondering whether is it possible to have two mailboxes with same name in an account? If yes then how to go about it ?


Solution

  • Question: I am probably unclear on this.

    Using select(mailbox=... you are dealing with Real Folders.
    Therefore no duplicate possible.

    IMAP4.select(mailbox=’INBOX’, readonly=False)

    Select a mailbox.
    Returned data is the count of messages in mailbox (EXISTS response).
    The default mailbox is 'INBOX'.
    If the readonly flag is set, modifications to the mailbox are not allowed.