I'm planning to move all my mailboxes to an IMAP server running on foolab.org, use offlineIMAP to sync between vader "my laptop" and naboo "foolab.org". It will also allow me to access my email from multiple computers at the same time.
I'm using mutt as my primary email client.
The big problem is offlineIMAP needs a local Maildir while I'm using mbox
I can upload the emails from mutt to the IMAP server but why do I have to redownlosd them again ? Beside, it's a lot of manual work.
I didn't really find a good mbox to maildir converter so I decided to use mutt.
Mutt knows how to handle such things. It's an email reader!
Thanks to the folks in #mutt for a few tips. Now here is my setup:
1) My mail is in ~/Mail
2) I don't have subdirectories
3) No white spaces in folder names.
4) You don't have a mailbox called "foo" ;-)
5) Create a directory called done. There we will place the mbox files after processing.
Now here how it goes:
1) Place this in a file, let's call it "/tmp/muttrc" and use emacs for that ;-)
macro index <F3> "<tag-pattern>~A<enter><tag-prefix><copy-message>=foo<enter>y<quit>y"
folder-hook . push <F3>
2) cd ~/Mail
3) Execute this bash snippet:
for i in `find -maxdepth 1 -type f`; do box=`basename $i`;
echo "Processing $box" && mutt -F /tmp/muttrc -n -m Maildir -R -f $box && mv $box done/ && mv foo $box; done
4) Now to convert my outbox "which is an MH dir":
mutt -F /tmp/muttrc -n -m Maildir -R -f done/outbox/
It worked fine for me. I had to interfere 2 times because I 2 had 0 sized mailboxes. Otherwise, it worked like a charm!
P.S. Don't forget to edit ~/.procmailrc and to set the default mutt mbox_type to Maildir
- 36914 views
Add new comment