Configuring QMail to use a Smarthost
Routing all mails to a smarthost
The file where SMARTHOST relaying to smarthost settings are kept is named smtproutes and is usually found in /var/qmail/control/. We use the hostname 'mxsrv1.spamgateway.comodo.com' on port 587 as outgoing server:
echo ":mxsrv1.spamgateway.comodo.com:587" > /var/qmail/control/smtproutes
This command will set qmail that all your mails will be routed to mxsrv1.spamgateway.comodo.com:587 (will remove other existing lines).
Routing all mails for a specific domain to a smarthost :
| Note: The information below relates to a very
specific customer requirement and is not recommended for most
deployments. A configuration like this can cause problems which will
be hard to troubleshoot. Unless you are sure you need to use this
setup, please explore the other available options for routing mail.
echo "example.com:mxsrv1.spamgateway.comodo.com:587" >> /var/qmail/control/smtproutes
This will route outgoing email to "example.com" via the smarthost. (rest of the lines will be kept).