cyrus-imapd/inboxfer
John Dennis 38f2261a6f auto-import cyrus-imapd-2.2.12-1.2.fc4 on branch devel from
cyrus-imapd-2.2.12-1.2.fc4.src.rpm
2005-04-15 20:24:15 +00:00

37 lines
979 B
Perl

#!/usr/bin/perl
#
# Usage: inboxfer inputfile
#
# Purpose: Transfer messages from Berkeley-format inbox to Cyrus inbox
#
# Input: Text file containing one username per line
#
# Warning: Do not use this script to transfer messages into a Cyrus
# mailbox that already contain messages. Existing messages
# will be overwritten.
#
#$Id: inboxfer,v 1.1 2005/04/15 20:24:15 jdennis Exp $
$mailstore = "/var/spool/imap"; # Cyrus mailstore
$oldspool = "/var/spool/mail"; # Old mail spool
$cat = "/bin/cat"; # /usr/bin/cat on Solaris
$formail = "/usr/bin/formail";
$pwd = "/usr/lib/cyrus-imapd";
$cpmsg = "cpmsg";
$cmd = "$formail -n 20 -s $pwd/$cpmsg";
$users = "$ARGV[0]";
if (!$users) { die "Usage: $0 $users\n"; }
open(USERS,"$users") || die "can't open $users";
while (<USERS>) {
chop;
$inbox = "$oldspool/$_";
$prefix = substr($_,0,1);
system("$cat $inbox | $cmd $mailstore/$prefix/user/$_");
}