procmail
[Top] [All Lists]

Re: The received path

2001-08-19 09:22:27
KJ asked,

| Using some ideas on this list I have the follow script:
|
|  :0 fhW
|         * ^Received:\/.*<[^>]+>
|         * MATCH ?? [    ]for[   ]+<\/[^>]+
|         |formail -a "X-Received-For: $MATCH"
|
| which displays the email address used to deliver to my machine.
| This is useful for me as I remove all the received lines before
| archiving.
|
| My question is how could I get a line:
|
| X-Received-Path: email1 email2 ...
|
| with the full list of email address used to get to my machine, ie
| one from each Received line?

Only with an outside process or two like this,

 :0h
 * ^Received:.*[     ]for[     ]<.*>
 XRP=|formail -cxReceived: | sed -ne '/[     ]for[    ]<.*>/H' \
     -e '$x' \
     -e 's/.*[     ]for[     ][     ]*<\([^>][^>]*\)>.*/\1/g' \
     -e 's/\n/ /gp'

 :0Afwh
 * XRP ?? [!-~]
 | formail -zA "X-Received-Path:$XRP"

or with a recursive INCLUDERC (but you'd still need the second formail call
at the end to add the results to the head).


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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