Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1366
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

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