Pushing / Forwarding Email from one Server to Another
#!/bin/sh
for i in /var/qmail/mailnames/<domain>/*
do
user=$(echo $i | cut -d'/' -f6)
for msg in $i/Maildir/{cur,new}/*
do
formail -n3 -s /usr/sbin/sendmail < $msg \ $user@<domain>
done
done
This will iterate through all the usernames in the domain directory of QMail, then look in the cur and new directory for message files and forward the emalis to $user@