rgladwell / imap-upload

Python script for uploading a local mbox file to IMAP4 server.
Other
131 stars 31 forks source link

folder create on each email upload #14

Closed mdidomenico4 closed 2 years ago

mdidomenico4 commented 4 years ago

it looks like based on this snippet of code and confirmed by my server logs, that on each email upload it tries to create the dest folder (either INBOX or --box) i presume. Can the code be modified to check for the existence of the folder first and if it doesn't exit then create it

383         try:
384             self.open()
385             self.imap.create(box)
386             return self.imap.append(box, [], delivery_time, message)
rgladwell commented 4 years ago

That would be a good idea, unfortunately I just don't have the time to work on this. If you could create a PR that would really help me out.

adriangibanelbtactic commented 2 years ago

I think you could just improve the code by having a list of created directories. That way you can ignore creating the directory again if it has been already created.

Then you can think on adding the code for checking if the directory already exists the first time you ever try to create it (original request of this issue).

adriangibanelbtactic commented 2 years ago

I think you could just improve the code by having a list of created directories. That way you can ignore creating the directory again if it has been already created.

Then you can think on adding the code for checking if the directory already exists the first time you ever try to create it (original request of this issue).

My latest pull request ( Google takeout fixes v1 - https://github.com/rgladwell/imap-upload/pull/36 ) implements the idea that explained here.

rgladwell commented 2 years ago

Thanks! Closing in favour of #36.