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

"-r" option only works where mbox files have extension "mbox" #61

Open
Behinder opened this issue Jun 30, 2022 · 8 comments
Open

"-r" option only works where mbox files have extension "mbox" #61

Behinder opened this issue Jun 30, 2022 · 8 comments

Comments

@Behinder
Copy link

Behinder commented Jun 30, 2022

If I import single file without extension it works however recursive option not work. Thunderbird stores mailboxes on Windows without giving them extension so with large number of mailboxes it can be pain to change them all manually. Is it any way for a program to detect mboxes anyway?

However even with that option script seems to stop after processing first folder

322/322   5.3 kB  Nowe wiadomości w skrzynce       OK (1 sec)
Done. (OK: 322, WARNING: 0, ERROR: 0)
Found mailbox at /Volumes/T5/LocalFolders/Archives/2011.mbox...

@Behinder
Copy link
Author

As a suplementary note I discovered that recursive option not work if folders have dot in names. In my case Thunderbird named the folders with ".sbd" extension

@rgladwell
Copy link
Owner

rgladwell commented Jul 1, 2022

Hi @Behinder, thanks for the report. Tou might want to raise that second bug as another issue.

Unfortunately, I don't know when I can get around to fixing this. If you have the time, a PR would be gratefully received.

@Behinder
Copy link
Author

Behinder commented Jul 1, 2022

I don't know if this is really fixable, I noticed that even with retry flag program during recursive tends to stop after importing one or two boxes, I had to delete them and run program again few times to finally import everything. Because --debug flag really does nothing and no error was raised I am not sure if something can be done.

@rgladwell
Copy link
Owner

Please don't lose hope. There have been a lot of changes in the repository recently. Please let me know if this version of the scripts works better for you:

https://github.com/rgladwell/imap-upload/blob/1d55a745b6ae2533b7d93e0baaa7182448c7b9e4/imap_upload.py

@panreyes
Copy link
Contributor

panreyes commented Mar 28, 2024

I've noticed that MBOX files don't have a header or magic bytes, so identifying them without the extension is quite difficult... but a quick solution for uploading Thunderbird MBOX files would be to search for .msf files, and then for their counterparts without extension.

I've made a quick & dirty fix to the script to make it work in my case:

        elif file.endswith(".msf"):
            print("Found mailbox at {}...".format(path))
            mbox = mailbox.mbox(path.replace(".msf",""), create=False)
            if (email_only_folders and has_mixed_content(src)):
                target_box = box + separator + src.split(os.sep)[-1]
            else:
                target_box = file.split('.')[0] if (box is None or box == "") else box
            if err:
                err = mailbox.mbox(err)
            upload(imap, target_box, mbox, err, time_fields)

Now it's detecting those Thunderbird mbox files :)

@rgladwell
Copy link
Owner

Thanks for posting that. It would be a big help if you raised a PR to include that fragment in the code base.

@panreyes
Copy link
Contributor

Done, thanks for letting me contribute to imap-upload! :)

@rgladwell
Copy link
Owner

Thank you for contributing. Does #66 fix this issue?

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

3 participants