Forwarding Email to another host via Qmail
Today I needed to relay/forward all Email from one Server (Server A) to another Server (Server B). Server A is running Qmail (on CentOS). Server B is running company smartermail.
After googling and searching, I found a site teaches “forwarding Email to another host” using Qmail. I tried, as the article recommends setting up a Qmail config file (which didn’t existed):
Containing a Qmail Email domain forwarding rule:
So If you are running Plesk Parallel Panel, Qmail was being run with virtual domain support and spotted a Qmail config file:
This config file contained the name of the domain I was trying to forward followed by a colon and a number, Must remove the line containing the domain name trying to forward, then restart the Qmail.
These are what you need to do, the process are:
#1. Back up all your current, working config files and if at all possible, do this using a test domain or sub-domain name so if you make mistakes you have a backup!
#2. Set up your destination Email Server to receive Email for the relevant (sub)domain and Email account(s).
#3. Ensure that the domain name you are trying to forward Email for is in the Qmail config file /var/qmail/control/rcpthosts (this ensures that Qmail will handle Email for the domain).
#4. A necessary to create the Qmail config file /var/qmail/control/smtproutes.
Add a forwarding rule to /var/qmail/control/smtproutes
If you want to forward all Email for all domains handled by your Qmail Server, you can use a wildcard config which means you omit the source domain name e.g.:
#5. Now you can restart Qmail:
$ /etc/rc.d/init.d/qmail restart
#6. Check your destination Email Server which should now be receiving Email sent to Server A for the source domain.
This worked fine for me using (source server) Centos/Fedora/Plesk 8,10,11/Qmail and destination server smartermail/Postfix.