Reply to comment

Pushing / Forwarding Email from one server to another.

When transfering domains from one server to another, sometimes the emails get delievered to the old server after the DNS has been updated. When that happens, you can run the following script to forward the emails to the other server, or to a different email address.

 

#!/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@<domain>

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options