qmail smarthost smtproutes

EQ Admin

EQ Forum Admin
Staff member

Would you like to configure a qmail server to relay all outgoing messages to another mail server? The file to create is /var/qmail/control/smtproutes. you can create both entries to forward all e-mail for a domain, or all e-mail regardless of domain. Sorry, but wildcards are not allowed in a standard smtproutes file.

To relay e-mail for a specific domain.com to another mail server create the line:


To relay all e-mail to another mail server, regardless of the destination domain, create the line:


It is OK to send e-mail for a few domains to alternate mail servers, and then have a catchall line at the end for any remaining domains, for example:



New Email
I hope this is pertinent to this "qmail smarthost smtproutes" posting, so here goes.
I need to configure qmail so that it will act as a smarthost or smartrelay for my Unix (ASP) server which only sends emails out. Due to the implementation of a new Anti-Spam feature in my SonicWall NSA2600 emails sent from the ASP server to domains hosted on my Linux qmail server are not getting to the email server. Emails from the ASP server to all other domains are received with no problem. When I set the qmail server up on my ASP sendmail config as a SMART_HOST in sendmail.cf all emails to domains on hosted on the Linux server began to work but all other domains stopped working. Both servers reside on my local network but because of the way the Anti-Spam feature works there is an internal conflict on the SW between the public and private address of the email server. I need to configure qmail to relay ALL email traffic from the ASP server to wherever it is suppose to go, not just the emails bound for domains it hosts.


EQ Admin

EQ Forum Admin
Staff member

The above directions are for where email should be relayed after being accepted by qmail.

I believe you are asking how to configure your qmail server to accept and relay email for other computers on your network.

How did your qmail get installed? Was it by following Life with qmail?

Check your qmail-smtpd run file. A typical location for the relay rules is:


For port 25 IP based relay you'll need lines such as:


Don't forget to remake the cdb file when done.

With some more specifics about your particular install of qmail I can help make more specific directions if needed.

Once the above is working you'll need to tell your unix host to relay mail through the qmail server, maybe using the DS option in your /etc/mail/sendmail.cf


New Email
I'm not the guy who did the install, but I will run all this by him asap. Here is what I have found:
I don't have a tcprules.d on this Linux system.
[root@linux /]# find / -name tcprules*

And a search for qmail-smtpd returns:
[root@linux /]# find / -name qmail-smtpd
All of these are binary.

This is an old server btw:
# uname -a
Linux linux.vsi-hou.com 2.4.21-63.ELsmp #1 SMP Wed Oct 28 23:15:46 EDT 2009 i686 i686 i386 GNU/Linux

EQ Admin

EQ Forum Admin
Staff member
Can you paste the contents of /var/qmail/supervise/qmail-smtpd/run in a reply?


New Email
WoooHooo! Thanks for pointing me in the right direction. We got it working by adding 10.:allow,RELAYCLIENT=" to /etc/tcp.smtp. Our local network is, so this allows any email generated from a server on the local network to be relayed.:thanks: