Setup DBMail with qmail

This is just a short list of things since I used to run qmail + dbmail (switched to postfix now) but maybe someone still needs it and it should help to get started at least

Qmail does not support lmtp so use dbmail-deliver.

It is assumed that qmail is set up to receive emails for the domains needed already (domains in rcpthosts and virtualdomains, aliases set up for addresses where needed, …).

Also I assume that your dbmail setup is complete and working. As always you can test it with the following if not sure(of course make sure the email address is actually created already):

echo -e "Subject: test"\\n"Date:`date`"|dbmail-smtp -d

First a user needs to be created (I called it dbmail – actually it could be done on a per-user basis with creating aliases,.. for individual users and only have some users use dbmail but the administrative part of that would be a nightmare). In the users home we create .qmail-default file with the following contents(the ':7' strips off the dbmail prefix we append from qmail - more about that below):

|/usr/sbin/dbmail-deliver -d ${RECIPIENT:7}

Then in /var/qmail/control/virtualdomains we need to add the prepend (see In our case it is the user we created earlier called dbmail


… add an entry for every domain you want to be handeled by dbmail (this way you could choose to not have all domains handled the same way..) – you could also do this on a per-user basis but I found that to be not very useful.

That should do the trick. One more thing smtp-auth with qmail is a pain if working at all with some patch. Pop-before-smtp works but you are out of luck if using imap. I just ended up sending mails using webmail and/or using my openvpn connection to send which i had allowed in tcpwrapper – but this is outside the scope of this ;))

DBMail is sponsored by