LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Qmail + Maildrop spam filtering with no vpopmail (https://www.linuxquestions.org/questions/linux-server-73/qmail-maildrop-spam-filtering-with-no-vpopmail-620492/)

rcase5 02-12-2008 01:29 AM

Qmail + Maildrop spam filtering with no vpopmail
 
Hi all,

I just recently completed an upgrade of my mail system. The system was just a plain qmail server, and it worked pretty well except it had no spam filtering; something many of my clients were clamoring for.

With the upgrade, I now have SpamAssassin and ClamAV. I'm very happy with the results, but I would like to have the server actually filter the spam, not just identify and brand it. In fact, one of my clients using SquirrelMail exclusively, so server-side filtering is really a must.

For the upgrade, I followed the QmailRocks formula for the most part. But during the upgrade, I discovered that vpopmail would have required that the users that use an MUA to change the way they log into their system. This was a headache I didn't want to deal with. Also, vpopmail requires that all mail be stored in one spot on my system instead of in the home directories of my users, which is the way my system has always worked. There are also some other reasons why I prefer mail be stored in the users's home directories, some logistical and others having to do with my comfort zone. So I excluded vpopmail from my configuration. It took some doing, but it does work!

Now I need to figure out the filtering. I've tried to configure maildrop to take all messages identified as SPAM into a folder called "SPAM". But everytime I try to put things in place, I don't get any messages at all. I take out the changes, and I get all of the message (in the INBOX, of course).

Here are the key files:

/etc/maildroprc:
Code:

import SENDER
DEFAULT=$HOME/Maildir/

~user/.qmail:
Code:

|preline /usr/local/bin/maildrop -d $USER ./.mailfilter
~user/.mailfilter
Code:

if ( /^Subject: :SPAM:/)
{
        to "$HOME/Maildir/.SPAM"
}

In the 'to "$HOME/Maildir/.SPAM"' line, I've also tried the following:
Code:

        to "$MAILDIR/.SPAM"
        to "Maildir/.SPAM"
        to "Mail/SPAM"

All to no avail.

Every solution that I've found that remotely resembles the QMR solution involves vpopmail. I DO NOT WANT TO USE VPOPMAIL! I'm hoping someone else has done what I'm attempting and can give me a few pointers. I don't understand why this is not working. Anybody have any ideas?

Thanks in advance,

Robert...

roreilly 02-14-2008 03:04 PM

Hi Robert,

I use the qmr install myself, but I use procmail to filter & move spam.

Here's an example of my setup:

my .qmail:

| /usr/bin/procmail -m /home/vpopmail/domains/dna13.com/roreilly/.procmailrc


And the relevant section of my .procmailrc:

Comments at the end of lines are for you, not part of my script.



# this recipe moves all spam that needs to be learned
# by spamassassin back into the spam monitoring folder
#

:0
* ^Subject:.*SPAM
{
foldername=SPAM

:0c
.$foldername/ # stores in .$foldername/new/

:0
* LASTFOLDER ?? /\/[^/]+$
{ tail=$MATCH }

TRAP="mv $LASTFOLDER .$foldername/cur/$tail:2,S"

HOST
}


:0:
*
$MAILDIR/new

# EOF

What happens here is that any messages with the subject line SPAM get moved into the spam folder designated, and marked as read (I don't bother checking the spam folder very often)

Any message that should be delivered is put in my inbox.

Hope this helps.

R.


All times are GMT -5. The time now is 02:37 AM.