Postfix with Spamassassin filter your mails
This article describes how to filter spammails with spamassassin and deliver them into a own postbox. A script delete the mails in this box after 7 days.
I’m using a Postfix Mailserver on Debian Etch with amavis and spamassasin.
Fist we want to catch only realy hard spam. Normaly no real mail get an Spamscore over 7 points. Change the required hits in the spamassasin configuration.
vim /etc/spamassassin/local.cf
required_hits 7.0
After that configurate the redirection in the postfix configuration:
vim /etc/postfix/main.cf
# Spam Forward header_checks = regexp:/etc/postfix/header_checks
vim /etc/postfix/header_checks
/^X-Spam-Flag: YES/ REDIRECT spam@yourdomain.com
/etc/init.d/postfix reload
Now all Mails with the Spam-Flag=Yes will be delivered to the spam@yourdomain.com account on your mailserver. If you miss any important mail, you can check this account.
Now create a script which delete this mails after 7 days.
vim /usr/local/bin/deleteOldSpam.sh
#!/bin/bash
find /path/to/your/mailhome/cur -type f -mtime +7 -exec rm {} \;
After that create an cronjob for this script:
crontab -e
0 1 * * * /usr/local/bin/deleteOldSpam.sh # Delete old Spammails
Now every day at 01:00 all spammails older than 7 days will be deleted.
Don’t forget to modify /path/to/your/mailhome/cur to the path where you store the mails of your spam account user.
Angelurlaub in Norwegen (22. – 29. Juli) Ubuntu Samba Winbind Artikel veröffentlicht


[...] http://www.mogilowski.net/lang/de-de/2008/09/22/postfix-with-spamassassin-filter-your-mails/ http://blog.aditsystems.de/2009/03/dovecot-imap-server/ [...]