Prerequisites
- Root access to your qmail server
- Your MailChannels SMTP username and password
- qmail patched to enable SMTP authentication (AUTH SMTP) — consult qmail documentation to apply the SMTPAUTH patch if not already done
- qmail patched with the qmailqueue patch (e.g., Bruce Guenter’s patch) to allow modifying headers before messages are queued
Configuration Steps
1
Configure the X-AuthUser Header
The Create the filter shell script:Create Create the Perl header script:Create
X-AuthUser header identifies the responsible sender in your system. MailChannels uses it to isolate compromised accounts without blocking other senders. This step uses Bruce Guenter’s qmailqueue patch and qmail-qfilter.Install qmail-qfilter:Apply Bruce Guenter’s qmail-qfilter patch if not already applied. Download the patch (search for “qmailqueue-patch”) and apply it to your qmail source, then recompile qmail.Modify your qmail-smtpd run script:Locate your run script (e.g., /service/qmail-smtpd/run or /var/qmail/supervise/qmail-smtpd/run). Add or modify the QMAILQUEUE environment variable before the exec qmail-smtpd line:/var/qmail/bin/qmail-authuser-filter.sh with the following content, then make it executable:/var/qmail/bin/qmail-authuser-filter.sh
Adjust the path to
qmail-qfilter if it is installed elsewhere./var/qmail/bin/qmail-authuser-header.pl with the following content, then make it executable:/var/qmail/bin/qmail-authuser-header.pl
For this script to capture the authenticated user, your tcpserver setup for qmail-smtpd must correctly set
TCPREMOTEINFO upon successful SMTP authentication.2
Configure MailChannels as the smart host
Edit or create
/var/qmail/control/smtproutes. To route all external email through MailChannels, add the following line — replacing the placeholders with your actual MailChannels SMTP credentials:/var/qmail/control/smtproutes
If outbound TCP port 25 is blocked in your network, use port
587 or 2525 instead::smtp.mailchannels.net:587 YourMailChannelsUsername YourMailChannelsPasswordThe leading colon : means this rule applies to all domains not matched by more specific entries in smtproutes and not listed in /var/qmail/control/locals.3
Restart qmail services
Restart the relevant qmail services for all changes to take effect. The exact command varies depending on your installation:Or, if managing services individually with daemontools:Consult your qmail installation documentation for the precise commands.
Verify the configuration
1
Send test emails
Send emails from an account on your server to a few external addresses (e.g., Gmail, Outlook.com) to confirm delivery.
2
Check mail logs
Examine your qmail logs (often under
/var/log/qmail/, or managed by multilog to directories like /var/log/qmail/qmail-send/current and /var/log/qmail/qmail-smtpd/current).- Look for lines indicating successful delivery via
smtp.mailchannels.net. - Check for any authentication or relay errors.
3
Review the MailChannels Host Console
Log in to your MailChannels Host Console and check Log Search to confirm your test messages are being processed. Verify that the
X-AuthUser header is present and correctly identifies the sender — the third field of the senderID value will contain the value qmail inserted into X-AuthUser.Optional: advanced qmail settings
These settings are configured by creating or editing files in/var/qmail/control/. Restart qmail-send (or run a full qmailctl restart) after making changes.
-
Queue lifetime (
queuelifetime) — how long in seconds a message stays in the queue before bouncing. Default is 604,800 seconds (7 days). -
Server identity (
me) — sets the FQDN of your mail server, used in HELO and other operations. -
HELO hostname (
helohost) — overrides the HELO name used by qmail-remote. If not set, the value frommeis used. -
Remote delivery concurrency (
concurrencyremote) — maximum simultaneous remote SMTP delivery processes. Default is 20. -
Local delivery concurrency (
concurrencylocal) — maximum simultaneous local delivery processes. Default is 10. -
Connection timeout (
timeoutconnect) — seconds qmail-remote waits for a connection. Default is 60 seconds. -
Remote response timeout (
timeoutremote) — seconds qmail-remote waits for each response after connecting. Default is 1,200 seconds (20 minutes).

