Blue Flower

Monday, 06 July 2015 00:41

How to disable bounces and double-bounces

Written by

Login to qmailadmin as postmaster for your domain and click the set catchall deleted at the bottom of the email account menu, or edit ~vpopmail/domains/ to look like the following:

| /home/vpopmail/bin/vdelivermail '' delete

(If you are using validrcptto, you will want this set to bounce-no-mailbox)

How to disable double-bounces

To discard double-bounces, follow these steps:

echo yourdomain.tld > /var/qmail/control/doublebouncehost
echo doublebounce > /var/qmail/control/doublebouncto
echo "#" > ~vpopmail/domains/yourdomain.tld/.qmail-doublebounce
qmailctl restart

This will tell qmail to deliver double-bounces to
This email address is being protected from spambots. You need JavaScript enabled to view it..

The "empty" (only has pound sign) .qmail-doublebounce file in that
domain's directory will tell qmail to deliver the message to nowhere.
Now you will no longer be bombarded with useless double bounces.

Enjoy the quiet. :)

Special thanks to Bill Arlofski

Monday, 06 July 2015 00:40

Understanding rcpthosts and locals

Written by

rcpthosts - domains that we accept mail for - mostly used for vpopmail virtual domains that reside in /home/vpopmail/domains

If rcpthosts does not exist, you are an open relay. If it exists and is empty and there is no "morercpthosts.cdb" file as well, then your server will reject all incoming mail.

locals - domains that we deliver locally - mostly used for local delivery /home/$USER/Maildir

What to put in rcpthosts and locals: domain names
What NOT to put in rcpthosts: IP Addresses

Taken from

Monday, 06 July 2015 00:39

Using POP before SMTP

Written by

Just skip the jsauth smtp patch and compile vpopmail with: ./configure --enable-roaming-users

Monday, 06 July 2015 00:39

How to access the qmail manpages

Written by

To add the qmail manpages, edit the following files:

For Bash (/etc/profile)

For *sh (/etc/csh.login for csh and /etc/.cshrc for tcsh)
setenv MANPATH "/var/qmail/bin:${MANPATH}

Please logout and log back in for those settings to take effect or type 'source ~/.cshrc'
if you're using tcsh

Monday, 06 July 2015 00:38

How to setup qmail graphs with MRTG

Written by

How to get the qmail graphs working with mrtg.
graphs inclue rbl, validrcptto, jgreylist, and more
By William Olson

# cd /path/to/stats
# fetch
# tar zxvf qmailmrtg2.tgz

Run the following commands to start the graphs at 0

# echo "     0" > /tmp/rbl-found
# echo "     0" > /tmp/valid-found
# echo "     0" > /tmp/jgrey-found
# echo "     0" > /tmp/vir-found

Edit the following files and change the "hostname" to your host in each file at the bottom
the uptime might need to be edited to work on your box

Note: When you are editing mrtg-clam, please note the location of the log file. If you are not using
the setup for, this path may need to be changed to /var/log/clamav/clamd.log


Now to set the correct file permissions:

# chmod 755 mrtg-clam
# chmod 755 mrtg-jgrey
# chmod 755 mrtg-rbl
# chmod 755 mrtg-valid

Now open up qmailmrtg.cfg and change the WorkDir at the top to the folder where the qmailmrtg will be saved
Change each instance of myhostname to your mailserver name or ip or whatever. Easiest way is to do it like so:


This is just a find and replace script. What this does is it replaces all instances of myhostname with newhostname

Scroll down to the end of qmailmrtg.cfg and change the following lines:

Target[clam]: `/path/to/stats/mrtg-clam`
Target[valid]: `/path/to/stats/mrtg-valid`
Target[rbl]: `/path/to/stats/mrtg-rbl`
Target[jgrey]: `/path/to/stats/mrtg-jgrey`

run /usr/local/bin/mrtg qmailmrtg.cfg and just make sure you don't have any errors.

Now to put the stats in cron:

*/5 * * * * /usr/local/bin/mrtg /path/to/qmailmrtg.cfg > /dev/null 2>&1

After about 15-20 minutes you should start seeing graphs.

Now to clean up the install:

# cd /path/to/stats
# rm qmailmrtg2.tgz
# rm install-*

Monday, 06 July 2015 00:36

How to enable bayes autolearning

Written by

Updated 2/9/10: Updated links so they worked correctly. Removed the references for maildrop and procmail spam filtering as they are now obsoleted.

There are a few things you need to train spamassassin to do before bayes can start learning how to tell the difference between spam and non-spam. The more you train bayes, the better the learning algorithm.

Before continuing on I want to let you know about 1 thing. If you are running the freebsdrocks spamd service, you do not have to change spamd to a non-root user. The service is configured to run as user qscand. Please skip down to the section that starts First to make sure bayes can be turned on, bayes needs to be trained for 200 hams and 200 spams. Run the following command:

Before starting with Bayes, one of the things I would suggest is running SpamAssassin as a non-root account. You can do this by adding an option to the startup script. Edit your SpamAssassin startup script and look for the following line. I give 2 different options depends on what version of SpamAssassin you're running.

Option 1: spamd_flags=${spamd_flags:-"-d -x -r ${spamd_pidfile} "}
Option 2: : ${spamd_flags="-c  "}

Add the -u qscand to make SpamAssassin run as user qscand:

Option 1: spamd_flags=${spamd_flags:-"-u qscand -d -x -r ${spamd_pidfile} "}
Option 2: : ${spamd_flags="-c -u qscand "}

The path or flags file may vary from system to system. When you are done, save and exit and restart spamd. All your spamd processes should now run as qscand.

First to make sure bayes can be turned on, bayes needs to be trained for 200 hams and 200 spams. Run the following command:

# sa-learn --dump magic

0.000 0 5752 0 non-token data: nspam
0.000 0 1702 0 non-token data: nham

As you can see from the above example, I have 5752 spams and 1702 hams
The spam and ham totals must be at least 200 each.

The nspam total is the total amount of spams Bayes has learned.
The nham total is the total amount of hams Bayes has learned.

Here is how to train SpamAssassin hams and spams.

There are a few ways to feed sa-learn spams and hams. The easiest way is
by running the command right from console. Lets just say that you have a
folder in ~vpopmail/domains/domain.ext/test/Maildir/spam. Run the sa-learn
command like so. Replace domain.ext with your domain andreplace user with the actual user on your system :

# sa-learn --spam ~vpopmail/domains/domain.ext/user/Maildir/.Spam/new

To learn hams in ~vpopmail/domains/domain.ext/user/Maildir/new, run

# sa-learn --ham ~vpopmail/domains/domain.ext/user/Maildir/new

You'll get an output similar to the following in wither either case. Actual messages numbers may vary.

Learned from 30 message(s) (30 message(s) examined).

This tells you that out of 30 messages in the new folder, 30 were learned. If you run sa-learn --dump magic, your nspam total will have 30 more new messages learned as spam.

You basically need 200 hams and 200 spams before you can enable bayes autolearning. Once you have done that, add the following lines to your

# The line below needs to point to the users bayes_path that spamassassin runs as. In this case, the qscand home folder is /tmp
bayes_path /tmp/.spamassassin/bayes
use_bayes 1
bayes_auto_learn 1
bayes_file_mode 0770

The first line tells the bayes path to tell bayes where to store the bayes database. The next line enables bayes. The next line after that enables autolearning. and the next line just forces a chmod of 770 on the bayes database for security reasons.

Restart spamd and within a day or so you will see autolearn appear in your headers. I am not sure why it takes so long for it to come into the header part of the emails. It just does for some reason.

Page 16 of 23