[techtalk] Converting PMMail files to Maildir or mbox format

Chris J/#6 sixie at nccnet.co.uk
Tue Dec 21 19:44:11 EST 1999

For Maildir (assuming you have a Maildir setup), just rename all the files 
<timestamp>.<pid>.<host> and put them in Maildir/new. You may be able to get 
away with making up <timestamp>; <pid> you can make up; <host> is just you're 
machine name. So a good script may be:

for i in *.MSG
	timestamp=`expr $timestamp + 1`
	mv $i $timestamp.$$.`hostname`
## Script end

For mbox, its more tricky. Essentially you just concatenate all the files 
together, but you need to make sure:
	1. There is a blank line between each message
	2. The first line of each message reads: "From <address> <date>",
		eg: From sixie at nccnet.co.uk Tue Dec 21 18:40:44 1999
		this is *independant* of the From: header.

A small script may be able to do this by stripping the information out of the 
Date: and From: headers. I could write one, but I'm going to leave that as an 
exercise for the reader :) Not certain, but I think the date part of the From 
line is fussy about the format, so best keep the format shown in the example 


@}-,'--------------------------------------------------  Chris Johnson --'-{@
    / "(it is) crucial that we learn the difference / sixie at nccnet.co.uk  \
   / between Sex and Gender. Therein lies the key  /                       \ 
  / to our freedom" -- LB                         / www.nccnet.co.uk/~sixie \ 

techtalk at linuxchix.org   http://www.linuxchix.org

More information about the Techtalk mailing list