[FUG-BR] Mover mensagens marcadas como SPAM

Giancarlo Rubio gianrubio em gmail.com
Quinta Outubro 11 09:40:23 BRT 2007


Pode usar procmail tbm

http://www.fug.com.br/historico/html/freebsd/2007-09/msg01036.html

Em 11/10/07, Leandro L J S<freebsd em fastcars.com.br> escreveu:
> Bom dia
> estou enviando um mailfilter do maildrop mais ou menos completo
> retire o que achar melhor ou use inteiro também hehehehe
>
> SIGA OS PASSOS ABAIXO
>
> vi /usr/local/etc/mail/mailfilter
>
> SHELL="/bin/sh"
> import EXT
> import HOST
> VPOP="| /usr/local/vpopmail/bin/vdelivermail '' delete"
> VHOME=`/usr/local/vpopmail/bin/vuserinfo -d $EXT@$HOST`
>
> ##
> logfile "/var/log/maildrop.log"
> log "$TIMESTAMP - BEGIN maildrop processing for $EXT@$HOST ==="
>
> if ( $EXT eq "" )
> {
> log " FAILURE: EXT is not a valid value ($EXT)"
> log "=== END === $EXT@$HOST failure (EXT variable not imported)"
> EXITCODE=111
> exit
> }
>
> if ( $HOST eq "" )
> {
> log " FAILURE: HOST is not a valid value ($HOST)"
> log "=== END === $EXT@$HOST failure (HOST variable not imported)"
> EXITCODE=111
> exit
> }
>
> ##
> # The message should be tagged, so let's bag it.
> ##
>
> if ( /^X-Spam-Status: *Yes/)
> {
> `test -d $VHOME/Maildir/.spam` # make sure .Spam folder exists
> if( $RETURNCODE == 1 )
> {
> log " creating $VHOME/Maildir/.spam "
> `maildirmake -f spam $VHOME/Maildir`
>
> }
>
>  log " SPAM: attempting quota delivery to $VHOME/Maildir/.spam"
> exception {
> xfilter "/usr/local/bin/deliverquota $VHOME/Maildir/.spam"
> }
>
> if( $RETURNCODE == 77)
> {
> log " QUOTA FAILURE: bouncesaying '$EXT@$HOST is over quota'"
> to "|/var/qmail/bin/bouncesaying '$EXT@$HOST is over quota'"
> }
>
> log "=== END === success"
> exit
> }
>
> log " message is clean"
>
> `test -r $VHOME/.mailfilter`
> if( $RETURNCODE == 0 )
> {
> log " including $VHOME/.mailfilter"
> exception {
>  include $VHOME/.mailfilter
> }
> }
>
> `test -e $VHOME/Maildir/maildirsize`
> if( $RETURNCODE == 1)
> {
> VUSERINFO="/usr/local/vpopmail/bin/vuserinfo"
> `test -x $VUSERINFO`
> if ( $RETURNCODE == 0)
> {
> log " creating $VHOME/Maildir/maildirsize for quotas"
> `$VUSERINFO -Q $EXT@$HOST`
>
> `test -s "$VHOME/Maildir/maildirsize"`
> if ( $RETURNCODE == 0 )
> {
> `/usr/sbin/chown vpopmail:vchkpw $VHOME/Maildir/maildirsize`
> `/bin/chmod 640 $VHOME/Maildir/maildirsize`
> }
> }
>  else
> {
> log " WARNING: cannot find vuserinfo! Please edit mailfilter"
> }
> }
>
> `test -e $VHOME/Maildir/maildirsize`
> if( $RETURNCODE == 0)
> {
> MAILDIRQUOTA=`/usr/bin/head -n1 $VHOME/Maildir/maildirsize`
> }
>
> ##
> # Include any other rules that the user might have from
> # sqwebmail or other compatible program
> ##
>
> `test -r $VHOME/Maildir/.mailfilter`
> if( $RETURNCODE == 0 )
> {
> log " including $VHOME/Maildir/.mailfilter"
>  exception {
> include $VHOME/Maildir/.mailfilter
> }
> }
>
> log " delivering to $VHOME/Maildir"
>
> `test -x /usr/local/bin/deliverquota`
> if ( $RETURNCODE == 1 )
> {
> log " WARNING: no deliverquota!"
> log "=== END === $EXT@$HOST success"
> exception {
> to "$VHOME/Maildir"
> }
> }
> else
> {
> exception {
> xfilter "/usr/local/bin/deliverquota -w 90 $VHOME/Maildir"
> }
>
> ##
> # check to make sure the message was delivered
> # returncode 77 means that out maildir was overquota - bounce mail
> ##
> if( $RETURNCODE == 77)
> {
> #log " BOUNCED: bouncesaying '$EXT@$HOST is over quota'"
> log "=== END === $EXT@$HOST bounced"
> to "|/var/qmail/bin/bouncesaying '$EXT@$HOST is over quota'"
> }
> else
> {
> log "=== END === $EXT@$HOST success (quota)"
> EXITCODE=0
> exit
> }
> }
>
> log "WARNING: This message should never be printed!"
>
>  chown vpopmail:vchkpw /usr/local/etc/mail/mailfilter
>  chmod 600 /usr/local/etc/mail/mailfilter
>  touch /var/log/maildrop.log
>  chown vpopmail:vchkpw /var/log/maildrop.log
>
>       Para o qmail usar o filtro acima com o procmail é necessário
>
>
>        echo '| /usr/local/bin/maildrop /usr/local/etc/mail/mailfilter' >
> /usr/local/vpopmail/domains/dominio/.qmail-default
>
>
>
> falow
>
>
>
> ----- Original Message -----
> From: "Fabiano (BiGu)" <bigu em grupoheringer.com.br>
> To: ""Lista Brasileira de Discussão sobre FreeBSD (FUG-BR)""
> <freebsd em fug.com.br>
> Sent: Thursday, October 11, 2007 7:13 AM
> Subject: [FUG-BR] Mover mensagens marcadas como SPAM
>
>
> Ae pessoal, tenho utilizado um qmail + clamav + maildrop + spamassassin
> num freebsd 6.2 ,o spamassassin ta rodando bacana, marcando as mensagens
> spam etc...
>
> O que to precisando é mover essas mensagens marcadas para uma pasta Spam
> criada na conta do usuario, uma vez vi um script que fazia isso, so que
> nao encontrei..
>
> Alguem tem ideia de como fazer isso?
>
> Abracos!!!
>
>
> -------------------------
> Histórico: http://www.fug.com.br/historico/html/freebsd/
> Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
>
> -------------------------
> Histórico: http://www.fug.com.br/historico/html/freebsd/
> Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
>


-- 
Giancarlo Rubio


Mais detalhes sobre a lista de discussão freebsd