Qmail + vpopmai l+ procmail + spamassassin

You might probably think that’s crazy…but yes it is possible. I have a qmail lazydog installation that has built in vpopmail. But no mailer is complete these days unless it features antispam and antivirus protection. So I though I should implement spamassassin + clamav. I won’t show how to setup spamd or clamd but how to process and deliver mails to users.
How it works:
inside each domain in vpopmail there’s a .qmail-default file that it has probably something like this,

| /home/vpopmail/bin/vdelivermail ” /home/vpopmail/domains/DOMAINNAME/postmaster

But we want to use procmail, so we make it like this:

| preline /usr/bin/procmail -p -m /home/vpopmail/etc/procmailrc

My procmailrc file:

# qmail Lazydog procmailrc file
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`

# Make sure that we have a .Spam and .Virus folder to sort spam and virus into.
# This will create directorys under the ~vpopmail/domains///Maildir
# direcory. This directory will be created as soon as the user
# recives any mail. It simply creates the .Spam and .Virus directories,
# as well as subscribes them to courier-imap
* ? test ! -d $VHOME/Maildir/.Spam
|( /var/qmail/bin/maildirmake $VHOME/Maildir/.Spam ; /bin/echo “INBOX/Spam” >> $VHOME/Maildir/.bincimap-subscribed )
* ? test ! -d $VHOME/Maildir/.Virus
|( /var/qmail/bin/maildirmake $VHOME/Maildir/.Virus ; /bin/echo “INBOX/Virus” >> $VHOME/Maildir/.bincimap-subscribed )

# Run Anti-Virus and Anit-spam tests.
| /var/qmail/bin/scanmail.sh

* ^X-Virus-Status: INFECTED

# Sort anything marked as SPAM into the users Maildir/.Spam/
* ^X-Spam-Status: YES

# Everything else goes to the users default Maildir/
| /home/vpopmail/bin/vdelivermail ” bounce-no-mailbox

notice the last 2 lines, they make procmail return the mail back to vpopmail so any quotas or other options are applied. Take a look at the Spam and Virus folders that are created inside each everyone’s account. scanmail.sh that is referred inside procmailrc is provided by the lazydog package. You can configure it as you want ..and it has a lot of options on how viruses and spam is treated.

Have fun with your secure and without spam mail….you do use smtp auth and ssl patches for your smtp+imap…don’t you ?

3 Responses to “Qmail + vpopmai l+ procmail + spamassassin”

  1. vult
    February 10th, 2008 | 01:34
    Using Mozilla Firefox Mozilla Firefox 3.0b2 on Windows Windows XP

    Thx dude 🙂

    Had to slightly modify your config but works flawlessly 😉

  2. Rubin
    February 12th, 2008 | 13:54
    Using Internet Explorer Internet Explorer 7.0 on Windows Windows XP

    Hi friend,

    I’ve seen that the link qmail lazydog doesn`t works. Do you know where i can find some information, please ??

    Thanks a lot!!

  3. February 14th, 2008 | 04:08
    Using Mozilla Firefox Mozilla Firefox on Linux Linux

    try getting qmail lazydog from here: http://www.lazyinstaller.net/pages/download.xhtml

Leave a reply