Fighting Spam with Qmail (part I)
Well, what the title says, mostly :-)
How to integrate qmail and spamassassin, so your mail gets filtered, trying to keep it simple.
Well, what the title says, mostly :-)
How to integrate qmail and spamassassin, so your mail gets filtered, trying to keep it simple.
Just one small comment. The ifspamh script doesn't appear to be a perl script but a shell script. By default, it is executed by ksh (#!/bin/ksh at top of script).
cheers,
steven
I was just going to say the same thing - I wrote it as a shell script to make it quicker to fire up - the whole idea being to avoid running a new Perl for each and every SpamAssassin check.
It will actually run under sh or bash as well as ksh - and works best with an implementation that has a built-in printf (just run 'type printf' at your shell prompt if you're not sure.)
I'll fix it. In fact, now I remember I had to install pdksh to make it work ;-)
I wonder where I got that perl idea.
Start redirecting any misclassified mail to the obvious address. Make sure you redirect it unchanged! usually, the "forward" feature of your mailer won't be good enough, since it will appear that the spam comes from you, and you don't want your own mail to be classified as spam, right? ;-)
I like this idea, but how do you get a mail client to redirect a mail unchanged? Especially outlook, which most users tend to use?
One way to do it is having a spam folder in your email server, and then just move the mails to that folder, then have spamassassin read all those folders. Can be a lot of work, though.
If you have a IMAP server with public folder support, then you can use that. It also has the advantage of being safer than a public spam@... address.
If none of that can be done, it is up to your email client. AFAIK, Outlook Express doesn't have a way to do this. Others do, and it's usually called "Bounce" or "Redirect" in the menus.
I just created 3 different imap-dirs. one in which spam-assassin puts spam and two other from which spamassassin will learn (cronjob). so you just have to move spam which was not cought by sa to your spam-learn dir. for no-spam the same. just use drag-and drop in your mail-client.
All works fine, but I am looking for a way so that spamassassin won't check outgoing messages, it makes my PHP scripts so slow... Anybody got some ideas?
Hi,
I know nothing about sh / ksh but would really like to see the software trigger on on X-Spam-Flag but on X-Spam-Level depending on the "*" rating.
That way, I could rewrite with subject_tag for, let's say all email with score between 6 (required_hits) and 12 and send them to a "sure spam" folder for anything above 12.
Must be trivial, it's just I don't know how to do the test ;-)
Thanks to anybody replying ...
I have set up all files *exacty* as described. Indeed, spam is being identified as shown by the maillog. However, after identifying I see the following message:
qmail: 1081953141.258573 starting delivery 7636: msg 2998483 to local 14-rolf.ernst-spam@24hourloop.com
Apparently qmail wants to send it to another user called rolf.ernst-spam. If this is how it has to be, I guess I could live with it.
However, is there a way to send it to a subfolder of rolf.ernst called 'spam' (or .spam)?
/re
Sorry for the *very* late reply: yes, that´s how it works. So, the .qmail-spam file in rolf´s home directory redirects rolf-spam´s mail to the spam subfolder like this:
./Maildir/.spam/
Assuming you are using a IMAP server that stores subfolders that way.
Tried this script, but do not have ksh installed so I tried changing the first line to /bin/sh.
When mail is received it is processed to Maildir, but it is not going through spamassassin at all. Mail comes through unchanged. no x-spam headers, no flag, nada. Thoughts? Or do I just need to install pdksh.
Thanks,
Roger
Roger: I assume you did modify the .qmail file for your user.
If you did, we'll need to check some logs.
Please email me (small envelope thingie on the article's page).