procmail
[Top] [All Lists]

RES: Auto CC

2006-07-17 12:40:12
Remember me?


Above is my solution.
It is working just fine.




SHELL=/bin/sh
PATH=/usr/bin:/bin:/usr/local/bin


HOMEDIR=`grep -i ^${LOGNAME}: /etc/passwd | awk -F : '{print $6}'`
MAILDIR=${HOMEDIR}/Maildir/
DEFAULT=${MAILDIR}


LOGFILE=/var/log/a
LOG="--- Logging for ${LOGNAME} "
VERBOSE=yes


#
# Catch all local domain e-mail recipients
#
TO=`formail -xTo:| sed -e 's/</\n/g' |  sed 's/>/\n/g' | sed s/" "//g |
egrep -i '(@TEST-DOMAIN.com$|@TEST-DOMAIN.com.br$)'`


#
# Who are in the same ${LOGNAME} group?
#
GROUP_ID=`grep -i ^${LOGNAME}: /etc/passwd | awk -F : '{print $4}'`
GROUP_MEMBERS=`grep :${GROUP_ID}: /etc/passwd | awk -F : '{print
"|"$1"@TEST-DOMAIN.com "}'`


#
# Lets forward emails to another members groups. ( members that dont
received this original e-mail only )
# X-TEST-DOMAIN-Loop tag meens do not replicate this message to group
members.
#
:0
* ! ^From(_dot_)*(_at_)TEST-DOMAIN(_dot_)com
* ! ^X-TEST-DOMAIN-Loop(_dot_)*(_at_)TEST-DOMAIN(_dot_)com
{
        #
        # Quem do grupo pam ainda nao recebeu o e-mail, enviaremos uma copia
        #
        MEMBERS_2_COPY=`for i in ${TO}; do GROUP_MEMBERS=\`echo
${GROUP_MEMBERS} | sed s/"|${i}"//g\`; done; echo ${GROUP_MEMBERS} | sed
s/"|$
        TOTAL_2_COPY=`echo ${MEMBERS_2_COPY} | wc -w | awk '{ print $1 }'`

        :0hfw
        | formail -i "X-TEST-DOMAIN-Loop: ${LOGNAME}(_at_)TEST-DOMAIN(_dot_)com"

        :0c
        * ! $TOTAL_2_COPY ?? 0
        ! $MEMBERS_2_COPY
}
 

 

 

-----Mensagem original-----
De: procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
[mailto:procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE] Em nome de 
Google Kreme
Enviada em: sábado, 8 de julho de 2006 03:21
Para: [procmail] Mailing List
Assunto: Re: Auto CC

On 07 Jul 2006, at 16:05 , Domingo Antonio wrote:
There is any way to prevent this?

Yes...

( not using formail ?D, please... )

Ah... well.  A bit like asking "Hey, how do I get this torx-10 screw loose?
(and not using a torx-10 screw, please)


--
I loved you when our love was blessed
I love you now there's nothing left
But sorrow and a sense of overtime




____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail




____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>