snippets / spamassassin

All snippets tagged spamassassin (1)

  1. mysa-lear

    Récupère les SPAMs contenus dans le dossiers .Junk des comptes d'un serveur mail. Les SPAMs sont appris puis effacés.

     1 #!/bin/bash
    2 ###############################################################################
    3 #
    4 # mysa-lear : Donne à apprendre les dossiers ".Junk" des comptes mail d'un serveur
    5 #
    6 # Remarque :
    7 # - Les comptes doivent être de la forme $VBOX_PATH/_domaine_/_user_/
    8 #
    9 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
    10 # Version 1.0
    11 #
    12 ###############################################################################
    13 # This program is free software; you can redistribute it and/or
    14 # modify it under the terms of the GNU General Public License
    15 # as published by the Free Software Foundation; either version 2
    16 # of the License, or (at your option) any later version.
    17 #
    18 # This program is distributed in the hope that it will be useful,
    19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    21 # GNU General Public License for more details.
    22 #
    23 # You should have received a copy of the GNU General Public License
    24 # along with this program; if not,
    25 # - write to the Free Software
    26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    27 # - See http://www.gnu.org/licenses/gpl.html
    28 ###############################################################################
    29
    30 # Mails
    31 MAIL_SUBJECT="spamassassin for $(hostname)"
    32 #MAIL_FROM="spamassassin@$(hostname)"
    33 MAIL_TO=root
    34
    35 BOX_PATH=/home/vbox
    36 TRASH_PATH=/home/vbox/scenario-paintball.com/trash
    37 NB_SPAM=0
    38
    39 # On parcour les comptes mails
    40 for spam in $VBOX_PATH/*/*/.Junk/cur/*; do
    41 #echo "$spam"
    42 sa-learn --spam "$spam" > /dev/null
    43 rm -f $spam
    44 NB_SPAM=$[$NB_SPAM+1]
    45 done;
    46
    47 # NB de SPAM dans le dossier trash :
    48 NB_SPAM_TRASH=$(ls $TRASH_PATH/cur/| wc -l)
    49
    50 # Rapport par mail :
    51 MAIL_BODY="$NB_SPAM SPAM appri(s) par spamassassin.\n\n$NB_SPAM_TRASH SPAM dans le dossier Trash."
    52 #echo -e $MAIL_BODY
    53 echo -e $MAIL_BODY | /bin/mail -s "$MAIL_SUBJECT" $MAIL_TO
    Posted by llaumgui to shell cron gpl spamassassin ... saved by 1 person ... 0 comments ... 9 months
showing 10, 25, 50 items per pages

Pages : 1

Flux RSS friendsnippetLatest snippets


More...