Koozali.org: home of the SME Server

Deleting spam on from POP3 server instead of downloading

Norrie

Deleting spam on from POP3 server instead of downloading
« on: March 05, 2003, 07:12:48 PM »
Hi,

My mail account is being filtered for spam using spamassassin and "[SPAM]" inserted into the suject line of my messages.  So far it seems to be working well.

Can I configure e-smith to check the subject line of the messages and delete them from the POP3 server if it finds "[SPAM]" rather than dowload them?
Many thanks for any help

Regards
Norrie
8o)

Bill Talcott

Re: Deleting spam on from POP3 server instead of downloading
« Reply #1 on: March 05, 2003, 11:50:12 PM »
There are many client-side utilities you can get to do this, like MailWasher (http://www.mailwasher.net).

If you install the User Manager panel and procmail, you could have the server do this filtering, as well as the ability to do much more complicated email processing.

Graham

Re: Deleting spam on from POP3 server instead of downloading
« Reply #2 on: March 09, 2003, 04:44:45 PM »
Under Windoze I use 'Popcorn' a fre util from www.ultrafunk.com

Of course it would be nice to get Smith to automate the whole process but I a guessing it is initially quite a complicated set-up.

Even my friends sometimes send me spam :)

Thomas Kristensen

Re: Deleting spam on from POP3 server instead of downloading
« Reply #3 on: March 09, 2003, 05:06:10 PM »
I had kind of the same issue with my SME server and Spamassassin. I filter email for most of my family through SME and Spamassassin but it was getting kind of irritating that the recipients still received the junk even though it was tagged with ****SPAM.

So I made a few adjustments to the server and the individual useraccounts, so that when Spamassassin detects spammail the spammail is sent to a specific mailaccount and NOT delivered to the intended recipient. This allows me (as BOFH) to scan incoming junk and decide whether a non-spam mail has been tagged incorrectly. Every non-spam mail is delivered normally.

This server-side filtering is done like this:

In a users homedir there is a file named .qmail. This file basically determines what happens when new mail arrives for the account. With SA installed it probably contains something like "ifspamh ..... ./Maildir".

The .qmail file should instead contain this line:

|/usr/bin/procmail ~/.procmailrc

This line tells SME that when new mail arrives, put it through procmail using a local .procmailrc file that determines what should happen. In the users homedir create a file named .procmailrc. You could also copy the template supplied with SA, I did that and modified it to my needs. My generic .procmailrc looks like this:

# SpamAssassin sample procmailrc
#
# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
:0fw
* < 256000
| spamassassin

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
#:0:
#* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
#almost-certainly-spam

:0
* ^X-Spam-Status: Yes
{

   :0:spam.lock
   ! spam@mydomain.com
}

:0 w  # pass along all other mail
./Maildir/

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
:0 H
* ! ^From[ ]
* ^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "

  :0 fhw
  | sed -e 's/^rom /From /'
}

Using the altered .qmail together with the above .procmailrc does what I was looking for - removing tagged spammail from a users mailqueue and forward it to another account. Of course you could send tagged spammail directly into /dev/null but I figure thats kind of hazardous...

I hope this can help you, if you need clarification don't hesitate to contact me...

Regards,
Thomas Kristensen

.nate

Re: Deleting spam on from POP3 server instead of downloading
« Reply #4 on: November 21, 2003, 09:13:41 PM »
This is great stuff!  However, it looks like you are editing the file directly rather than the template (the e-smith way).  I am interested in a global procmail config for all users that will be used with a low-level SA setting and in fact WILL send all the known-to-be-spam to /dev/null
 
Any chance on something closer to a 'How To' on this subject?
 
.nate