Skip to content

Spamlearn script amavisd-new

2008 March 12
by Philippe Delodder

The script is used to learn
spam from a junk or spam folder and ham from the default inbox folder.
It’s specially made for virtual mail accounts. For example:

  • /home/vmail/test@example.com
  • /home/vmail/test@foo.com

This script is shown here below, you can also download it here

#!/bin/bash

SADIR=/var/lib/amavis/.spamassassinDBPATH=/var/lib/amavis/.spamassassin/bayes

echo "Learning from virtual users:";for user in $(ls -1 /home/vmail); doif [ -d /home/vmail/$user/.Junk ]; thenecho " - $user spam"echo -n "   - "sa-learn --spam /home/vmail/$user/.Junk/cur -u $user --dbpath $DBPATHecho " - $user ham"echo -n "   - "sa-learn --ham /home/vmail/$user/cur -u $user --dbpath $DBPATHfidoneechoecho "Done."chown -R amavis:amavis $SADIR

To use the script you only need the .Junk folder to your spam-folder.

No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS

Bad Behavior has blocked 203 access attempts in the last 7 days.