• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1378
  • Last Modified:

Forwarding all spam to a single mailbox using SpamAssassin and Qmail

Hello all,

I'm trying to get spam under control. The boss has agreed to the following scenario. Any message that gets flagged as spam, from any of our domains, to be forwarded to a "global" spam mailbox.
I have successfully integrated SpamAssassin with Qmail to mark emails as spam. Now I just need some help
with putting them into another mailbox.

What I've done thus far is
rename /var/qmail/bin/qmail-queue to be qmail-queue.orig
made a shell script with the name qmail-queue with just one line
    spamc -f | /var/qmail/bin/qmail-queue.orig

I running on
RHEL 2.6.9-22.EL
SpamAssassin 3.1.9-1
Qmail 1.03
Plesk 8.0.1

Any help, even just advice, would be appreciated.
0
zarko_r
Asked:
zarko_r
  • 3
  • 2
2 Solutions
 
Cyclops3590Commented:
i probably won't be of much help, because i don't know how qmail works, but the first thing that comes to my mind is procmail.   If you can get the email to be processed by procmail as its being delivered you can have it look at the subject line and see if it was flagged, if so forward it to the spam mailbox, else just deliver it.

keep in mind i haven't used procmail either as i haven't had the need for it yet, but from what i've read, that is one use for it.
0
 
zarko_rAuthor Commented:
I can't use procmail because the control panel we use (Plesk) integrates with Qmail. Thanks for the suggestion though.
0
 
Cyclops3590Commented:
ok, so i take it you don't have command line access to the server then
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
zarko_rAuthor Commented:
I have full root access. It's a dedicated server for all our small companies. The control panel is used by some of the other people in the company to make minor changes so I can't remove it and do everything manually.
0
 
Cyclops3590Commented:
you shouldn't have to.  have you looked at procmail yet to be sure.  you simply need to have it where qmail uses it for delivering the email to the mailbox instead of it doing that itself.
0
 
myrondCommented:
Are you using vpopmail?

Here is one I through together for my own system that works fine with vpopmail (if you don't use vpopmail I'll rewrite it otherwise)

put in your .qmail file:
--
|preline /usr/bin/maildrop -w 90 /etc/maildroprc
--


touch /etc/maildroprc
chmod 600 /etc/maildroprc
chown vpopmail:vpopmail /etc/maildroprc (or equivalent)

put the following into your /etc/maildroprc file
--
import EXT
import HOST

SHELL="/bin/sh"
VHOME=`/var/lib/vpopmail/bin/vuserinfo -d $EXT@$HOST`

VPOP="$VHOME/.maildir/"
if ( "no such user" =~ /$VHOME/:d )
{
VDOMHOME=`/var/lib/vpopmail/bin/vdominfo -d $HOST`
VPOP3=`cat $VDOMHOME/.qmail-default | cut -f4 -d' '`
VPOP="$VPOP3/.maildir/"
EXT=`echo $VPOP3|cut -f7 -d'/'`
HOST=`/var/lib/vpopmail/bin/vdominfo -n $HOST`
VHOME=`/var/lib/vpopmail/bin/vuserinfo -d $EXT@$HOST`
}

exception {
include "/var/www/data/${EXT}@${HOST}.mailfilter"
}

# or where ever you want it to go.
if (/^X-Spam-Flag: YES/)
{
        to "$VHOME/Maildir/.advertisements"
}



exception {
to "$VPOP"
}
--

This script will probably not work out of the box for you as you'll need to change the options of where you want to go but.....  it does work.

If you give me more details I can massage it around or you can.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now