Guide updated on 29th of February 2016

Configure Qmail


It's time to configure Qmail ...

Copy the script to its proper locations

cp /downloads/scripts/qmailctl /var/qmail/bin/qmailctl (View the script qmailctl)

Adapt script permission

chmod 755 /var/qmail/bin/qmailctl

The script /var/qmail/rc (View here) is no longer used.

In original qmailrocks installation guide, it was used in script send_run replaced by service-send-run (from John M.Simpson) in this guide.

Create needed symlinks

ln -s /var/qmail/bin/qmailctl /usr/bin

Set Maildir as default mailbox type (./Mailbox for mbox type)

echo ./Maildir > /var/qmail/control/defaultdelivery

Set some configuration (You can find more on http://www.lifewithqmail.com/lwq.html#configuration)

echo 255 > /var/qmail/control/concurrencyremote
echo 30 > /var/qmail/control/concurrencyincoming
echo 3 > /var/qmail/control/spfbehavior
echo postmaster > /var/qmail/control/bouncefrom
echo yourdomain.tld > /var/qmail/control/doublebouncehost
echo postmaster > /var/qmail/control/doublebounceto
echo 'MEDIUM:HIGH:!SSLv2:!MD5:!RC4:!3DES' > /var/qmail/control/tlsserverciphers

cd /var/qmail/control/
chmod 644 bouncefrom doublebouncehost doublebounceto concurrencyremote concurrencyincoming spfbehavior tlsserverciphers

Set maximum message size to be 8Mb

echo '8000000' > /var/qmail/control/databytes

Set 30 seconds as timeout

echo 30 > /var/qmail/control/timeoutsmtpd

Allows localhost to send mails

echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
qmailctl cdb

If you use backup MX servers or if this server is acting as smart host for others, I advice you to add execute command :

echo 'OTHER-SERVER-IP:allow,RELAYCLIENT="",QS_SPAMASSASSIN="1"' >> /etc/tcp.smtp
qmailctl cdb

If you want to learn other available options, take a look on this sample.

Create mail aliases

echo some_address > /var/qmail/alias/.qmail-root
echo some_address > /var/qmail/alias/.qmail-postmaster
echo some_address > /var/qmail/alias/.qmail-mailer-daemon

Where some_address is the system user or email address you want these addresses aliased to

chmod 644 /var/qmail/alias/.qmail*

Final configuration

cd /usr/src/qmail/qmail-1.03
./config-fast host.domain.tld

You should have an answer like this :

Your fully qualified host name is host.domain.tld.
Putting host.domain.tld into control/me...
Putting domain.tld into control/defaultdomain...
Putting domain.tld into control/plusdomain...
Putting host.domain.tld into control/locals...
Putting host.domain.tld into control/rcpthosts...
Now qmail will refuse to accept SMTP messages except to host.domain.tld.
Make sure to change rcpthosts if you add hosts to locals or virtualdomains!

Edit /var/qmail/control/locals and remove host.domain.tld

Configure Daemontools


Users comments
Olegivy - 06/03/2023 13:06

Install QMAIL on Debian 11, work fine!

Thank you for the instructions, it helped a lot!

There was only one problem that I could not solve. When DENY_TLS=0 in /var/qmail/supervise/qmail-smtpd/run, smptd crashes
qmail-smtpd[2688]: segfault at beefa400 ip 00007f8341b4dff4 sp 00007ffc525acd40 error 4 in libssl.so.1.0.0[7f8341b11000+5e000]

For testing, I set DENY_TLS=1. Everything is fine in this mode. This is not critical for work, but maybe there is some workaround?

 

 

 

Thibs - 17/10/2014 15:33

If you have  followed this entire guide, it's already the case.

Check expecially http://qmailrocks.thibs.com/outlook2007.php the part "Send e-mails through an authentificate connection on your server with SMTP-SSL"

I you want to adapt /etc/tcp.smtp,  I think it's only 

.:allow,RELAYCLIENT=""

(then modify /service/qmail-smtpd/run for the authentication)

Vincencio - 15/10/2014 04:12

Can Anyone give sample of tcp.smtp that can allow all IPs to send email through mail server with username password authentification

Thanks


Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.