Spam mails: filtered but still distracting
Like everyone else I receive a lot of spam mails. I am running spamassassin and it works rather fine: only one or two false-negatives per day and so far just one or two false-positives (can't remember when I set it up, I guess for a year or two...). My current setup is Cyrus-IMAP as an IMAP server (running on a separate Debian GNU/Linux server) and KMail as the client. Spamassassin is invoked by procmail and mails that are marked as spam are filed in a special mail folder 'Spam'.
There was just a tiny little thing left that made spam still an annoyance. KMail is always running and it features a little icon in the systray that shows the number of new mails. I do not get too many 'real' mails, so it is not too much of a distraction, if I have a quick look at incoming mails as soon as they arrive (and it does not hurt, if people get a quick response...). The only problem is that KMail also counts mails in the 'Spam' folder, which resulted in 'new mail' messages every few minutes.
To fix this, I let procmail deposit spam mail in a new directory '_spamqueue' in my Maildir folder (which does not show up as a mail folder, because mail folders have a leading dot):
:0 * ^X-Spam-Status: Yes $MAILDIR/_spamqueue
Before the change the procmail rule was:
:0 * ^X-Spam-Status: Yes $MAILDIR/.Spam/new
With this change spam mails will not appear on the IMAP server, but they are not lost either. Then I created a cronjob that runs once a day, so I can check for false-positives once in the morning and not everytime the spam comes in:
#!/bin/bash
for USERDIR in /home/users/*; do
if [ -e $USERDIR/Maildir/_spamqueue/ -a -e $USERDIR/Maildir/.Spam/new ]; then
for MAIL in $USERDIR/Maildir/_spamqueue/*; do
mv $MAIL $USERDIR/Maildir/.Spam/new/
done
fi
done
This script simply moves all mails from '_spamqueue' to the IMAP folder 'Spam' (from where it moves to /dev/null after I took a quick scan for false-positives).
There are probably other methods to accomplish this, like using a different program for mail notifications that only checks the inbox. But KMail is already running and has this tray icon, so this was the easiest way to do it (for me).
- Written on March, 13 2005 at 01:36
You are reading the (archived) weblog of Benjamin Niemann. This weblog has been closed, no new articles will be posted here.
If you can read german, you may have a look at my new weblog.