Closed vzaliva closed 2 years ago
This would be a useful enhancement, possibly behind a CLI parameter flag.
Unfortunately, I don't have much time to dedicate to this project at the moment. If you need it sooner and have time yourself, I'd be happy to give advice and review code.
In order to avoid work overlap you should know that I am working on adding this feature in our branch: https://github.com/btactic/imap-upload/tree/google_takeout .
The current implemented functionality saves the emails in the first (or last) label/folder. Not in everyone of them as you might want to.
Note: I ported and adapted functionality from https://github.com/ldidry/gmail-mbox-to-imap which was based on an older version of imap-upload.
Fantastic! Feel free to raise a draft PR here. I'd love to see what you're doing.
My last pull request brings Google Takeout functionaly: https://github.com/rgladwell/imap-upload/pull/35 . Waiting for your feedback there.
Thank you.
Thanks for fixing this. Merged!
Thanks for fixing this. Merged!
Thanks for your merge.
Feel free to rewrite this part: https://github.com/rgladwell/imap-upload/blob/9273178fef70a4ee2a7e52cdab3b84552eb8d0be/imap_upload.py#L300-L318 in a more pythonic way (or without auxiliary list variables) if you think it's needed.
Also this function: https://github.com/rgladwell/imap-upload/blob/9273178fef70a4ee2a7e52cdab3b84552eb8d0be/imap_upload.py#L590-L600 should be renamed from def create_folders(self, boxes):
to def create_folder(self, boxpath):
.
It actually doesn't deal with several folders but with one of them which can have parents in it.
And, well, you might end renaming it to create_box
because what I understand as 'imap folder' you call it 'imap box' because I guess it's a more traditional way of naming it.
What I mean is that even if my code is functional it can be improved a lot by python experts.
I want to use this script to import
mbox
file created via Google Takeout service. They export all mail as a single mbox file. However, each message has an additional header specifying to what folder the message belongs to. E.g:It would be great if this script can handle these.