imapbox icon indicating copy to clipboard operation
imapbox copied to clipboard

How to get all gmail "folders" (labels)

Open slaecker opened this issue 8 years ago • 2 comments

Hi (again),

I'd like to archive my gmail account (among others) using IMAPBOX. Currently it only fetches the inbox. Gmail uses IMAP folders to reflect its labels. An email can be assigned multiple labels so it appears in multiple IMAP folders. All archived emails appear under [Gmail]/All messages "folder". The hierarchy shown in my email client (evolution) is as follows:

Gmail account

  • INBOX
  • Label 1
  • Label 2
  • Other Labels ...
  • [Gmail]
    • All messages
    • Sent
    • Drafts
    • Spam
    • Important
  • More labels ...

What to set the remote_folder to in order to archive all folders?

Another point (maybe beyond the scope of this script) is that due to the fact that the same email can be in multiple folders to save disk space some kind of checksum and symlinking would be great. So an email assigned to "Label 1" and "Label 2" would be symlinked from the "All messages" folder to the respective label folder.

slaecker avatar Jun 07 '17 20:06 slaecker

The emails are stored using the email as folder name, this should prevent duplication

the remote_folder is used in select method from imaplib, you can use this example: https://stackoverflow.com/questions/33684770/python-imap4-select-mailbox-name-contain-space-character-error?rq=1

the bad news is you can select only one folder per connexion

polo2ro avatar Jun 08 '17 07:06 polo2ro

Not tested but #27 and setting

remote_folder=__ALL__

in the config file might fix this.

olajep avatar Mar 23 '20 02:03 olajep