-
Notifications
You must be signed in to change notification settings - Fork 30
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
How to use Apple export script to import to Thunderbird #543
Comments
@johnstonesnow |
I exported all my local mail using Mac Mail's export mailboxes function. So I have a nested tree structure with folders and mboxes. |
@johnstonesnow |
Ok, that would explain it. But I have no idea what script, I know the thread you're referring to but I can't follow it now it's gone into technical stuff. I am not a dev, but even if I was, I thought the last I read was that the script is broken and nobody has time to fix it, is that right or is there something working that you think it might be worth trying to learn how to run? |
@johnstonesnow The most important thing is to make a backup of your export because the script modifies the tree in place. Since it might take a couple of tries you want the backup to start over. |
Thanks. Yes I took a zip backup to burn and put in safe for keeps. Let's see if I can work out how to follow these instructions! |
@johnstonesnow |
Hmm, as suspected, it's not for average folks, dev-types only! but I am trying. But I will be stuck when i get that installed. "An experimental script to restructure an Apple Mail export, applembox2sbd.py, is available in the utility-scripts folder of this repository." I can see a page of code at the link, but what do I do with it? Thanks |
download the script with the raw link. |
Thanks, but I hardly understood a word. I have backup (duplicate folder) of my exported tree. |
I clicked the "raw" button and got a full page of the code/script |
do I copy that and paste into terminal or something? |
Hmm. I installed the python3 installer package. it completed successfully. To confirm I went to terminal and typed "python" again, hoping to see V3 installed but it still says V2: "Python 2.7.10 (default, Feb 22 2019, 21:55:15) Do I need to reboot for it to take effect? |
I have to run out but will be back in an hour or two to make some attempt at running this script. Just bear in mind I have no clue about making directories in terminal, or even finding a directory. Only way I have ever got a file location into terminal is by dragging and dropping a finder folder at the end of a command. |
yes hmm I don't know how to make python 3 the default. |
just looked. |
@johnstonesnow |
hehe, thanks. python3 - that did it :) ... "Python 3.12.2 (v3.12.2:6abddd9f6a, Feb 6 2024, 17:02:06) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin So... "copy and save as the script name". |
@johnstonesnow |
Hi, that's extremely kind of you. I am sitting down for an hour (minimum) now. |
@johnstonesnow |
Hi Christopher, sorry to hear that. I am in EU so it's the small hours now and usually that'd be fine but I have to be up early tomorrow and can't adjust it. Can I make a suggestion, especially given you dont have a lot of time... Back and forth one command at a time may be ideal to avoid mistakes but I suspect it's unnecessary. IF (and only if) you have the time, maybe you could just give me some bullet point instructions and I think I will be able to follow those when I get back tomorrow lunch time. Whilst I am no developer, I do have a bit of experience with Mac (terminal and finder stuff in Library etc), I certainly know more than the average Mac user. I can create a directory under home, I have created one called mboxcvt alongside movies, pictures etc, in user home folder which i assume is what you mean. Hopefully you can drop some steps for me to follow beyond that and I will give it a whirl tomorrow. Dont worry about mistakes my end, worst case I have a TimeMachine drive backing up every hour so I can always roll my system back but I am sure that won't be necessary. i have run a script or two before over the years, as well as adjusting one or two files in Terminal (such as to stop the damn update notifications!) I have to run now but really grateful for your kindness helping me here. Drop me some tasks and let's see if I can impress myself (if not anybody else :D) Thank you |
Ha, you are supposed to be John (Snow of Game of Thrones?) %-) Next step, download script:
Setting up other directories, you can do regardless of above working
We will have to interact tomorrow any time after 12 Eastern time. |
Yes, well spotted, but you're forgetting I have to do sentry duty to watch out for white walkers :-D OK, step by step.... - Click script link and look for download button on top right,, box with down arrow in it Ok, by "script link" I assume you mean the one that goes to this page - https://github.com/thunderbird/import-export-tools-ng/blob/master/utility-scripts/apple2mboxsbd.py - Should download to your download dir, then move to our mboxcvt dir I downloaded it straight into mboxcvt dir
ha, no such file or directory. Get this, I remembered one of about 3 commands I know (maybe I was lying when I said I wasn't a dev :) !) and did a "ls" to list contents. Then realised you put the 2 in the wrong place :D - So I ran: python3 apple2mboxsbd.py
Yep! Output: "usage: apple2mboxsbd.py [-h] [--verbose] [--dry-run] IN
I am assuming I can do this in Finder so will do it that way. I think I remember mkdir being the command but lack of confidence leads me to Finder wherever possible. Ok, now we're cooking on gas :) Ok, these last two bullets I got a bit stuck with. - copy your export tree into both directories Assuming I know what you mean but want to be 100% sure before I do anything further. by "export tree", am i right in thinking you mean the entire folder full of exported folders from Mac Mail? If so, you mean my folder called "mailboxes export" which is on my desktop, looks like this: So should I select all contents OF 'mailboxes export', and copy those into the two folders we created? - Explain the top levels of directories in exptree Wasn't sure but maybe you just mean for me to show what they look like, hopefully done that above. If my assumptions are correct, I think we are now at the point you hoped I'd be. :) Thank you again, sorry for all the typing but seems easier for you to read (every detail of my actions) rather than me asking and waiting for you to answer, and have to type more needlessly. |
@johnstonesnow Then screenshot the exptree directory, with luck we will have our transform. |
Finished! I watched Finder live as it happened, like magic. :) Old on left, New on right Looks like it worked to my untrained eye. 25 items in each folder Are we looking good? thanks so much for this Christopher |
@johnstonesnow |
Great! |
Yes it wouldn't surprise me to find the error was on the mac side bash: out.txt: command not found... |
Please don't overdo it on this, no pressure as i have these emails backed up and accessible on the imac for the foreseeable future |
Well the re-index of Mac Mail failed. Gonna have to work on clearing some room, this SSD is so full. Will work on that. Here's a screenshot of a few of them in trash, no idea where those numbers on folder names came from! |
Afternoon... |
Hi Christopher.
What are your thoughts on this please? |
I would definitely do the rebuild and reindex. Then do the import again and we can see if there are any problems after that. |
Roger that, thanks |
Just a thought... Is there any chance that grep count command would work on Mac? If so, I could try counting the Mac Mail exported folders just to see what numbers come back in terminal |
I missed your comment about being interested in grep count for Sent folder. Here's what I reported earlier for Mac v TB: Mac - 37,374 msgs Here's what that grep count command returned for Sent folder: 5176 Looking like you're right about wonky Mac counts! |
I just looked at folder properties on two folders:
9.81GB (Mac) and 9.8GB (Fedora) - suggests all data came over, so any failure would have to be Mac Mail's fault i think. Idea - I do have another more powerful iMac (used for business stuff). Just wondering whether I could take the Mac Mail export I have, via USB stick, to the more powerful iMac, and create a temp new user account to try importing it into Mac Mail there. Wouild be interesting to see if folder counts are different |
WELL would you believe it! Firstly, the most incredible part: I think I managed to 'hack' my way through an exercise which could be VERY insightful here. You'll laugh when you see how simple what I 'achieved' was (if I did indeed achieve what I think I did!) Secondly... I wanted to try doing the grep/count command on Mac, on matching folders from the mac export (before script run and converted). I changed directory to do what we did on LInux, but soon learned (when Mac terminal reported it) that the .mbox files are actually directories. So the same command won't work, but I then went a level deeper into the .mbox folder, to see two files in each (mbox, table of contents). I thought a count on the mbox would be the same as the counts we did on linux, though I confess I was just guessing my way through hoping my logic was't too far off. I ran grep -c 'From ' 'mbox' once inside each of the three folders I counted yesterday on Fedora. Well lookie here: Trash Archive - 9948 The numbers I got doing the grep on Linux (on converted files in exptree folder) were: Trash - 9948 Have a I made as much progress as I think? (In confirming your suspicion of wonky Mac Mail msg counts?! |
Yes, I think that is very clear here, good sleuthing. |
Yes I actually tried that yesterday (select all mails). It doesn't show how many are selected, I am sure it did years ago. I have trouble with OCD, so tell me, is this my OCD or does it make ANY sense doing (as I'd like to)... After reindex, actually regardless of whether numbers change or not in mac Mail, I fancy doing it all again, export mac mail (after reindex), reconvert, reimport to TB on Linux. Am I mad wanting to do that? Or would you agree it would be worthwhile? thank you |
No not OCD. The massive delta in the counts presumably is because of bad housekeeping in MM. Something like not reseting a counter after a big delete. If you really need more you could check the actual mbox files used in the system as opposed to the export. |
I like your thinking! I'll have a go at that. |
BTW, I would also keep your original export just in case the rebuild does something funky. |
sounds good, but hopefully you can do something better with your weekend %-} |
Yes, remember what I said about OCD :-D By the way, I just found the folder containing all mail data for Mac Mail. It claims to contain 31.67GB of data. That's worrying. I guess it's possible that Mac Mail screwed up its own export, meanwhile your script converted everything it was asked to, and that's where the discrepancy lies. Reindex first. Then export again. I may also try taking the live maildata folder to the better iMac, create a temp user to push that data into, then try exporting from mac mail there, would help me rule out this old dog of a Mac faiing on export. "If you really need more you could check the actual mbox files used in the system as opposed to the export." - I just tried that. when i go to the directory in terminal, even just 'ls' command fails with "Operation not permitted". Maybe it's a 'mac thing' that you can't dig in that much. MM is not running so can't see why I am not allowed. But more to the point, I looked in Finder and of course prior to export it's all emlx files in a huge nested tree of folders. Will just go with a reindex and hope things become clearer. Thanks again C PS Ha, what's a weekend?! |
far, far away in an unknown galaxy and planet, there was a place where people actually valued there time and actually named a part of their week, just for pleasure and "chilling" ...Never heard of it. |
hahaha. you and me both. |
Well the reindex wouldn't work but I eventually found out it works better in Safe Mode. Did that and successfully reindexed all Mail data on Mac. Then I ran a new full export of all local folders, just as last time. But last time the total size of export was 9.81GB. This time it's 10.27, that's a fair bit more, and i haven't added any emails to those folders, so maybe the reindex helped. Soon find out, going to try the conversion script again overnight and see what it looks like when i import the new set to Thunderbird. Will post the result |
That delta is odd. |
If short on time please ignore this post, it's just an update but it's irrelevant now as my next post will explain. It's all very odd! Here's the latest... I did as i said above, did a fresh python conversion, and a fresh import into a new folder created for the purpose in TB. Example, Sent Items Archive: So this second batch seems to have fixed that folder and got them all this time. I have a Trash Archive I am still struggling with. 13925 on MM. 9672 on TB first time, exactly the same second time. So currently I am wondering if it's just too much to ask of the script, these huge folders with over 10k msgs inside. Truth is, after refreshing my head and taking a renewed look at the situation, all the most important stuff looks to be in TB. Those old archive folders are just there for future legal reasons, so they are not unimportant, but I don't actually NEED them on my fedora laptop. So I am thinking worst case I just do this: Store MM export AND the converted exptree on a USB stick in firesafe. I can import (either to a mac or TB) in the unilkely event I need to trawl back through those old mails any time in future. |
Ok, I think I have everything sorted out. Won't bore you with the details but I did lots of manual checks and can't find any missing emails, it's possible there are, but I took backups to put in the firesafe (of MM and TB) so I do 'have' it all if ever need to find a very old email in the future. I used duplicate remover addon to clean up and it did find a good few thousand dupes. I still suspect Mac email counts could have been 'wonky' as you first suspected. Either way, I have everything secured (if not on this machine) and so I now have a good working Thunderbird installation with all my important emails in the folders they should be in :-) Thank you again Christopher, you were beyond superb here. I have made a donation (through a friend with Paypal) and will write a review on the plugin page shortly. Take care of yourself and keep up the amazing work you're doing. |
Mark I have enjoyed working together on this and of course am here if you run into anything else. Follow up: For storage, probably archival quality optical discs then high quality HDD. Definitely not solid state devices. I can get you the more complex grep regex that distinguishes between message From separators and From in bodies. When you get counts like you do it should be obvious. On the script, it's actually not written by me, but @obar who really deserves a lot of credit (thanks @obar!) Neither IETNG or Thunderbird have issues with file sizes as yours. I have users with 7-12GBs I think all but the Trash is on target and I just think it's a mac mail thing. We proved whatever is being exported is being imported. Finally, isn't it also possible to export to individual eml files? That would allow another comparison. |
Appreciate your comments fully Christoper, but as a recipient of such great help (rare in my experience for 'noobs' like me), and with you being the giver of such help, I argue strongly that I am the most pleased beneficiary of the interaction. :P "Definitely not solid state devices." - Wow, glad I asked! I'd have thought they were the most 'stable' due to least moving parts, but your reply shows why I felt it best to check my 'assumptions', those being the mother of all mistakes of course! Thank you to @obar from me too! Re eml files - when I get some time I may have a look into that. For now, I feel I can finally have a bit of confidence in this machine and can finally STOP using the imac I have long wanted to use for target practice :). (Backups will be in safe in both folder structures so i should be good i think regardless of what weirdness was going on!) |
Excellent. |
Thanks! |
p.s. |
Yes, it did take me a minute or so. I'm English after all. :-P |
I have a load of local folders in Apple Mail (NOTE: It's running on OSX 10.14 Mojave, old style)i. exported these from Mac Mail which took a few hours at least.
I have followed instructions to import into TB via this plugin. Tried every option possible but fails every time with message: "Import Done 0/0"
Any ideas appreciated.
The text was updated successfully, but these errors were encountered: