procmail
[Top] [All Lists]

Re: Subject/To rewrite

1997-07-02 08:17:00
Joel Saacks spaketh thusly at dman:

Hi there

Can anyone tell how to do the following:

If the "From" user is joel, and the message is going "To" sms.co.za,
send the message to test(_at_)sms(_dot_)co(_dot_)za with the Subject being 
what was
originally the user part of the destination address.

EG.

From: joel
To:   12345(_at_)sms(_dot_)co(_dot_)za

would become

From: joel
To: test(_at_)sms(_dot_)co(_dot_)za
Subject: 12345

This could also be done (and probably more efficiently) by "\/" and
"$MATCH" rather than formail/sed although I find this way easier to
follow:

        #
        # Grab the "email name proper" with formail:
        #
        ENP=`formail -X'From: ' | formail -zrtx'To: '`
        #
        # sed out the user/domain parts:
        #
        USERP=`sed "s/@.*//" $ENP`
        DOMAINP=`sed "s/.*@//" $ENP`
        #
        # Do the headers rewrite:
        #
        :0fhw:
        * {Whatever needs to be true to trigger this recipe}
        | formail -I"To: test(_at_)$DOMAINP" -I"Subject: $USERP"

Lates!
--------------------------------------------------------------------------
Tim <bodysurf(_at_)pobox(_dot_)com>                         
mailto:bodysurf(_at_)pobox(_dot_)com
Finger bodysurf(_at_)pobox(_dot_)com for my PGP public key (Bits 1024/KeyID 
09DA5C49)
PGP Key FingerPrint (09/03/94):  4C97 F1FA 7055 6891   49D1 ADF2 DD63 0C15
--------------------> Please PGP encrypt your email <---------------------

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