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.Dieser Artikel beschreibt, wie man Spam E-Mails mit Spamassassin filtern und automatisch in ein eigenes Postfach zustellen lässt. Außerdem soll ein Skript diese Mails automatisch nach 7 Tagen löschen.

I’m using a Postfix Mailserver on Debian Etch with amavis and spamassasin.Ich benutze dazu einen Postfix Mailserver unter Debian Etch sowie Amavis und 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.Zuerst soll nur wirklicher Spam verschoben werden, normalerweise bekommen echte Mails niemals einen Spamscore über 7 Punkte. Deshalb passt man zuerst die Spamassassinkonfiguration an:

vim /etc/spamassassin/local.cf
required_hits 7.0

After that configurate the redirection in the postfix configuration:Danch muss noch das automatische Verschieben in das Spampostfach eingerichtet werden:

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.Nun werden alle Mails mit dem Spam-Flag=Yes automatisch in das Postfach von spam@yourdomain.com geleitet. Wenn man eine wichtige E-Mail vermisst, dann kann man in diesem Postfach nachsehen.

Now create a script which delete this mails after 7 days.Zuletzt soll noch ein Skript angelegt werden, welches die Mails nach 7 Tagen löscht.

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.Jetzt werden jeden Tag um 01:00 Uhr alle Mails im Postfach des Spam-Accounts automatisch gelöscht.

Don’t forget to modify /path/to/your/mailhome/cur to the path where you store the mails of your spam account user.Nicht vergessen den Pfad /path/to/your/mailhome/cur anzupassen, wo die Mails des Spam Users gespeichert werden.

This Post Has One Comment

Schreibe einen Kommentar zu Wie kann ein Postfix Mailserver eine Mail weiterleiten an GMX, AOL oder WEB.DE ? | Game Review Database Antworten abbrechen

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.