Ben Lutgens wrote:
> 
> Hey all, I am converting from sendmail / cyrus to qmail / courier.
> I have some imap-only users who would like to keep thier mail in tact as is.
> Problem is cyrus keeps things in an odd format. I need to find a utility to
> convert from cyrus style mailboxes to mbox or Maildir format to make the
> transition to the new mail server.
> 
> The mbox to Maildir conversion is easy, a util comes with qmail to do just
> that (I really really like qmail, Dan Bernstein is my hero) so if I could get
> the cyrus boxes into mbox, I'd be golden.
> 
> Any pointers would be greatly appreciated. As I have searched every search
> engine I know of and turned up nothing. The documentation for cyrus sucks, and
> there is no mentiion anywhere of converting from those oddball mailboxes to
> anything else.
> 

try this perl script (it's ugly q&d).  The only messages it failed on
for me was spam that deliberately left out the From: line.  It prints
it's output to standard out and is non-destructive to original messages.

I ran it like this
 perl from.pl /usr/local/cyrus/spool/user/paul/[0-9]*. > test.mbox

( I need to teach my spell checker about perl )

Eric

--- cut ---
#!/usr/local/bin/perl

foreach $file (@ARGV) {
  open (TMP, $file) or do {
        print STDERR "Couldn't open $file : $!\n";
        next;
  };
  undef $who;
  undef @body;
  undef @header;
  while (<TMP>) {
        push @header, $_;
        chomp;
        if (/^From: /) { # what we want
                if (m/From:\s+(?:.*?)<(.*)>(?:.*)$/) {
                        $who = $1;
                } else { # wasn't angled so hope for the best
                        s/^From:\s+(.*?)(?:[()\s]+.*)$/$1/;
                        print STDERR "From [$_]\n";
                        $who = $_;
                        $who =~ tr/\"//d; # remove quotes
                }
        }
        last if ($_ eq "\n"); # this could burn you if blank line isn't
newline
        last if ($_ eq "\r\n");
  }
  @body = <TMP>;
  close TMP;

  if ((!defined($who) || ($who eq ""))) {
        print STDERR "Not able to determine who it's from (skipping
$file)\n";
  } else {
        $time = localtime();
        print "From $who $time\n";
        print @header;
        print "\n";
        print @body;
        print "\n";
  }
}
--- end cut ---
> TIA
> --
> Ben Lutgens             cell: 612.670.4789      http://www.sistina.com/
> Sistina Software Inc.   work: 612.379.3951
> Code Monkey Support (A.K.A. System Administrator)
> 
>   ------------------------------------------------------------------------
>    Part 1.2Type: application/pgp-signature