GMail MBOX to Maildir
How to use these two Python/Perl scripts to migrate a GMail inbox to a cpanel / dovecot / maildir inbox — when you have a lot of emails and other, simpler, imports fail.
You'll need FTP and SSH access to the server; or, if you can't connect over SSH, make sure there's a file manager that permits unzipping in your host's admin interface.
1. Download MBOX from Google Takeout
2. Split MBOX by labels
./mbox_split.py --infile google_mbox.mbox --prefix split_
You may need to
chmod 755 mbox_split.py to be able to run.
Alternatively, you can just export by label from Google Takeout directly.
3. MBOX to Maildir
./mb2md.pl -s ~/path/to/split_Inbox.mbox -d ~/path/to/output/Inbox
- may need
chmod 755 mbox_split.pyto be able to run
- source and destination need absolute paths
4. Zip the
new/ folder for each output mailbox
5. Upload Zip to server in appropriate maildir mailbox folder, and expand via SSH:
unzip -j Inbox.zip rm Inbox.zip
-j flag will make sure the zipped
new folder will extract in-place, with no additional folder structure)