Here is what I came up with. Feel free to use, improve, ignore, etc.
#!/bin/bash
#
# A script to delete a user from qmailtoaster, moving that person's mail
to a
# folder in a designated user's INBOX and forwarding future mail to that
# designated user as well.
#
# By Warren Melnick ([EMAIL PROTECTED]) 10-Feb-2006
# Released under the GPL version 2, 10-Feb-2006
#
# The default destination user goes here
DESTUSER="[EMAIL PROTECTED]"
MAILEXEDIR="/var/qmail/bin"
SRCUSER=$1
SRCNEWFOLDER=".Old_Mail_$(echo $SRCUSER | sed s/[.]/_dot_/g | sed
s/@/_at_/g)"
if [ "$SRCUSER" == "" ]; then
echo Usage: $0 user_to_be_moved \<user_to_place_old_mail_in\>
exit 1
fi
if [ $2 != "" ]; then
if [ $($MAILEXEDIR/vuserinfo $2 2>/dev/null | grep -c dir) != 0
]; then
DESTUSER=$2
fi
fi
DESTDIR=/$($MAILEXEDIR/vuserinfo $DESTUSER 2>/dev/null | grep ^dir | cut
-d/ -f2-)
SRCDIR=/$($MAILEXEDIR/vuserinfo $SRCUSER 2>/dev/null | grep ^dir | cut
-d/ -f2-)
if [ "$SRCDIR" == "/" ]; then
echo User $1 does not exist in the mail system.
exit 1
fi
if [ "$DESTDIR" == "/" ]; then
echo The Destination user, $2, does not exist in the mail system.
exit 1
fi
rm -f $SRCDIR/.qmail
rm -f $SRCDIR/Maildir/maildirsize
echo "owner aceilrstwx" > $SRCDIR/Maildir/courierimapacl
mkdir $DESTDIR/Maildir/$SRCNEWFOLDER
mv $SRCDIR/Maildir/* $DESTDIR/Maildir/$SRCNEWFOLDER
echo "INBOX$SRCNEWFOLDER" >> $DESTDIR/courierimapsubscribed
$MAILEXEDIR/vdeluser $SRCUSER
$MAILEXEDIR/valias -i $DESTUSER $SRCUSER
echo Done.
---------------------------------------------------------------------
QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]