Hello all,
I try to collect all IP-nrs from the
"Received: from"-lines in a variable XIP.
I ran my test (in my $HOME) as follows:
formail -s procmail -m .procmailrc1 < Mail/test > test.out
Mail/test is a standard mailbox-file with several messages.
Each time, XIP only holds the IP-nr from the first Received-
line, the following Received:-lines are not MATCHed.
Regards, Ruud
#--------------------------------------------------------------
# .procmailrc1
#--------------------------------------------------------------
DEFAULT=|
LINEBUF=4096
SHELL=/bin/sh
LOGABSTRACT=yes
VERBOSE=on
LOGFILE=$_.log
FORMAIL="formail"
# WSP contains [<space><tab>]
WSP="[ ]+"
QUAD="0*([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
IP=$QUAD\.$QUAD\.$QUAD\.$QUAD
XIP=""
REGEXP="^Received:${WSP}from.*[^0-9.]$IP"
MATEXP="^Received:${WSP}from.*[^0-9.]\\/$IP"
:0
*$ ()\/$REGEXP(.*$)*
{
#HEADERLINES holds the headerlines, from the first Received:-line onwards.
HEADERLINES = $MATCH
INCLUDERC = XIP.rc
}
:0 fh w
* XIP ??
| $FORMAIL -A"X-IP-CHAIN: $XIP"
#--------------------------------------------------------------
# XIP.rc
#--------------------------------------------------------------
:0
* $ $MATEXP
{
XIP=$XIP[$MATCH]
:0
* HEADERLINES ?? $ $REGEXP(.*$)*\/$REGEXP(.*$)*
{
HEADERLINES = $MATCH
INCLUDERC = $_
}
}
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail