imap-upload
imap-upload copied to clipboard
Folders beside / within INBOX
On a mailcow mail setup, folders are located parallel to INBOX:
Just list mail boxes!
"Test" #UnMarked
"Archive" #UnMarked #Archive
"Trash" #Marked #Trash
"Junk" #UnMarked #Junk
"Sent" #UnMarked #Sent
"Drafts" #UnMarked #Drafts
"INBOX"
on a Hetzner Mailserver (Level 9 Webhosting) all folders are below INBOX
"INBOX"
+- "test" #Marked
+- "Trash" #UnMarked #Trash
+- "spambucket" #UnMarked #Junk
+- "Sent" #Marked #Sent
+- "Drafts" #UnMarked #Drafts
+- "Templates" #UnMarked
On the latter, creation of folders and append fails (using --google-takeout) with
Traceback (most recent call last):
File "/home/leonard/src/imap-upload-poldy79/imap_upload.py", line 426, in upload
raise Exception(r2[0]) # FIXME: Should use custom class
Exception: b'Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.000 secs).'
)
I am not sure if this is already covered by imap-upload.py and I have overseen something or if this is not yet supported. If I prefix the path for imap.create_folder and imap.append with "INBOX" everything works fine.
I could provide a solution, might be a switch --everything-below-inbox ? What do you think?
It seems that --google-takeout-box-as-base-folder
fixes my problem.
But I think that imap.namespace() could give the hint automatically.
Hetzner returns ('OK', [b'(("INBOX." ".")) NIL NIL'])
, where (("INBOX." ".")) describes the private Namespace.
Mailcow returns ('OK', [b'(("" "/")) (("Shared/" "/")) NIL'])
where (("" "/")) describes the private Namespace
With this information the "Base-Folder ("INBOX" or "") could be deducted, as well as the folder_separator.
Sorry for the delay in responding to this. I'm on holiday this week, will try and get back to this next week.
With this information the "Base-Folder ("INBOX" or "") could be deducted, as well as the folder_separator.
This would be a great feature. Maybe it could even be a more generic to automatically default the --folder-separator
argument.