Lee Hoffner wrote:
:0
^From:.*\<(lhoffner(_at_)directedmotion(_dot_)com)
You don't need the parentheses there.
{
REC=`formail -zx "Received:"`
In this case, you don't need to save it in a variable. I realize that
extracting into MATCH won't work here, because you want REC to have the
contents of all Received: headers, not just one of them; but that's not
the reason you don't need to run formail.
:0
* ? $REC = 'from slartibartfast.homebody.net (unknown [192.168.1.3]) by
email1.homebody.net (Postfix)*'
That's the wrong syntax for testing the contents of a variable. Also,
the trailing asterisk doesn't mean what it seems you expect; there's a
difference between regular expressions and shell globbing patterns.
{
You don't need the extra nesting level.
:0 :
$MAILDIR
You're saving to a $MAILDIR as a classic procmail directory and asking
for a local lockfile? That *has* to be wrong, but I can't correct it
because I don't know the folder nor the format where you want it stored.
}
}
Have I written bad syntax?
Yes, so let's tackle it all. Unfortunately, the strings to be matched
include a lot of characters that normally are magic in regexps but need
to be taken literally (periods, parentheses, left brackets), and we have
to match across a fold, where the particular whitespace characters are
unpredictable, so the regexp is on the hairy side:
:0 # empty-looking brackets enclose space+tab
* ^From:.*\<lhoffner(_at_)directedmotion\(_dot_)com
* ^Received:.*from slartibartfast\.homebody\.net \
[(]unknown \[192\.168\.1\.3]\)[ ]+by \
email1\.homebody\.net \(Postfix\)
$MAILDIR
Here, I want $REC to match this particular beginning of a string for
Received:, plus anything after.
The "plus anything after" is automatic if you don't anchor it to the
end; as I was saying, regular expressions work differently from shell
globbing patterns when it comes to that.
And again, it doesn't make sense to use $MAILDIR (which is a reserved
variable for changing and reading procmail's current working directory)
as a classic procmail directory, so I'm sure that isn't what you want to
do with a message that meets the conditions.
For the record, if you want to check whether a variable's contents match
a regular expression, the syntax is
* variablename ?? regexp
as in
* REC ?? ^from slartibartfast\.homebody\.net \
[(]unknown \[192\.168\.1\.3]\)[ ]+by \
email1\.homebody\.net \(Postfix\)
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail