Qmail smtproutes
A classic!
smtproutes
is a file used by qmail to specify the routing of outgoing mail. It's a simple text file that contains a list of rules to determine where to send outgoing mail.
Here's a breakdown of the format:
- Each line represents a single routing rule.
- The format is:
domain host:port
domain
is the domain name for which the rule applies.host:port
is the hostname and port number of the mail server to use for sending mail to that domain.
For example:
example.com mx.example.com:25
example.net mx.example.net:25
In this example, when qmail receives an outgoing email destined for example.com
, it will send it to mx.example.com
on port 25. Similarly, when it receives an email destined for example.net
, it will send it to mx.example.net
on port 25.
You can also use wildcards and regular expressions to make the routing rules more flexible. For example:
*.example.* mx.example.com:25
This rule would match any domain that ends with .example.
and send it to mx.example.com
on port 25.
The smtproutes
file is usually located in the /var/qmail/smtproutes
directory, but the exact location may vary depending on your qmail configuration.
When you update the smtproutes
file, you'll need to restart the qmail service or run the qmail-smtpd
command with the -R
option to reload the routing table.
That's it!