Force auto learn all spam manually moved to Junk-folder

Discussion in 'Installation/Configuration' started by simonit, Apr 15, 2015.

  1. simonit

    simonit New Member

    Hi, I have problem with Finnish spammers (mostly unwanted adds). I would like to force spammassasin auto learn all emails manually moved to Junk-folder to be spam. But I do not found way to force auto learn, there is that auto learn threshold which is bit big (over 12points).
    Before ISPConfig I was using ZPanel with sauser-functionality and there was this blacklisting feature that will add some points with listed senders, so spammassasin will got next time points over the threshold and move mails to Junk-folder aromatically.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can learn spam from spam folder automatically, all you need is a script that goes trough all spam folders, e.g. one per day, and feeds them to sa-learn. ensure that you run sa-learn with sudo under the amavis user, so it gets into the right spam database.
  3. DantePasquale

    DantePasquale Member HowtoForge Supporter

    FWIW here's what I did following various instructions - I'm pretty sure there's a better way and I haven't fully tested, but at least the correct bayes files get updated ;)

    # as root
    apt-get install bindfs
    su - amavis
    mkdir /var/tmp/amavis
    # to root's shell
    # create the bindfs mount and map the users vmail and amavis
    bindfs -r --map=vmail/amavis /var/vmail /var/tmp/amavis

    su - amavis
    # use showdots just to see that something is going on, lol
    /usr/bin/find /var/tmp/amavis/*/*/Maildir -maxdepth 1 -not -ipath '*/*Junk*' -not -ipath '*/*Trash*' -not -ipath '*/Maildir' -not -ipath '*/*spam*' -type d -exec /usr/bin/sa-learn --ham --showdots {} \;
    /usr/bin/find /var/tmp/amavis/*/*/Maildir/ -type d \( -iname "*Junk*" -o -iname "*spam*" \) -exec /usr/bin/sa-learn --showdots --spam {} \;
    # back to root's shell
    kill -HUP `cat /var/run/amavis/`

Share This Page