Sometimes mailboxes get so big they choke the mail client, and downloading the mail becomes painful, if not impossible. This is where formail (in the procmail package on Debian) comes in way handy. Here is a quickie recipie:
- Stop your MTA
- Copy the mailbox to a differnet location (so you have the original if you screw up..)
- Find out how many messages are in the damn thing, do this with grep -c "^From " [mailboxFile]
- split the mailbox with formail, you can do it like this:
cat [mailboxFile] | formail +[offset] -[lmit] -s > [newFragmentFile]
I did it in fragments of 10 messages per file, like this:
cat shell.mbox | formail -10 -s >mbox.1
cat shell.mbox | formail +10 -10 -s >mbox.2
cat shell.mbox | formail +20 -10 -s >mbox.3 - if its one big message that is causing the problem, you should be able to figure out which message it is by the size of the fragments. After that its a case of finding out the exact number (use a pager on the individual file) and using formmail to split the mailbox before and after, and merge the 2 parts into a new mail box without the offending message. If it is a case of too many messages, you probalby need more help then what I can give. I suggest looking at the fragements and see if there is a pattern of message that you can filter on. Maybe you are the victim of a mail loop?
- copy your new mailbox back to the original spool file
- restart your MTA
Tada!
Once you've split everything this way, you can probably manipulate the files directly with Thunderbird, it uses the mbox format.