Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folders beside / within INBOX #46

Open
poldy79 opened this issue Apr 20, 2022 · 3 comments
Open

Folders beside / within INBOX #46

poldy79 opened this issue Apr 20, 2022 · 3 comments

Comments

@poldy79
Copy link
Contributor

poldy79 commented Apr 20, 2022

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?

@poldy79
Copy link
Contributor Author

poldy79 commented Apr 23, 2022

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.

@rgladwell
Copy link
Owner

Sorry for the delay in responding to this. I'm on holiday this week, will try and get back to this next week.

@rgladwell
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants