By Dave Voorhis <firstname.lastname@example.org> February 26, 2003.
Revised November 03, 2003.
Revised November 10, 2003.
Revised September 30, 2019.
.qmail file intercepts mail to the user's usual address (say,
email@example.com) and passes it via
stdin to a
modified CRM114 mail filter. The filter classifies the mail and resends it to one email address for 'non-spam'
messages and another address for 'spam'. The 'non-spam' address is usually
configured to drop mail into the user's main mailbox or Maildir; the
'spam' address usually drops mail into a subfolder of the user's main
Maildir or delivers it to another account.
This is accomplished with a combination of
mailfilterconfig.crm files based
on those found in the
mailfilterconfig.crmconfiguration file, while still sending 'non-spam' messages to
mailfilterconfig.crmfiles, downloaded as described above.
.qmail filesand how they work. Try
man qmailfor more information.
.qmailfiles specific to your account and/or the ability to create them.
.qmailfiles for your account are stored.
.qmailfiles are kept:
You may want to copy the supplied
but it's not a requirement. The mail filter will create them as needed, and will learn rapidly from
your own spam and non-spam if you train it. (See Teaching Your Mail Filter to Behave below.)
mailfilterconfig.crmfiles into your home directory, or wherever your personal
.qmailfiles are kept.
.qmailfile, copy it to a new file named
XXXXXis a random number.
If you do not have an existing
.qmail file, create a
new file named
XXXXX is a random number.
.qmail-cleanXXXXX file should be configured
to deliver mail to your main mailbox or Maildir, eg:
XXXXX will help prevent spamsters who read this
article from easily guessing your 'non-spam' address. Naturally, you
should not distribute it or publish it on the Web -- not that there
would be any reason to do so.
.qmail-spamThat file should contain instructions to direct spam mail to a useful place. For example:
If spam mail will be redirected to some other account, you don't need to do this.
.qmailfile, you can do this with
chmod +t .qmail
|/usr/bin/crm ./mailfilter.crm > /dev/null; echo "Filtered by mailfilter"
mailfilterconfig.crmfile to contain your password (See Teaching Your Mail Filter to Behave below) and the appropriate 'non-spam' and 'spam' email addresses. If you're using sub-addresses, the 'non-spam' address will be something like
firstname.lastname@example.org the 'spam' address will be something like
chmodas described above, you'll probably want to
chmod -t .qmail
command <yourpassword> spam' header, as described under Teaching Your Mail Filter to Behave below. This will create the
spam.cssfile, if it doesn't exist.
command <yourpassword> nonspam' header, as described under Teaching Your Mail Filter to Behave below. This will create the
nonspam.cssfile, if it doesn't exist.
.qmailfile. Solutions to this are beyond the scope of this article, but the qmail log files should provide hints.
When a message is incorrectly recognized as spam that shouldn't be spam, send it back to your own address with the following first line:
command yourpasswd nonspam
When you receive a message that failed to be recognized as spam when it should have been, send it back to your own address with the following first line:
command yourpasswd spam
Replace 'yourpasswd' in the instructions above with the password
you set in the
Other facilities are described in the CRM114 documentation.