Gerardo asked,
| I'm trying to filter those emails who don't have @ in the ^From section.
|
| Why this does not work?
|
| :0
| * !^FROM(_dot_)*(_at_)(_dot_)*
| ! ihateyou
Micha's answer is not right: there is no need to escape the at-sign, so doing
that won't change anything.
Steve was on the right track, but he was right about many things and wrong
about some others. "*" is what means "zero or more of the preceding"; ".*"
means "zero or more of `.'" and "." means "any character except a newline,"
so ".*" means "any string, possibly null, as long as it's within a line."
First, don't let the ^TO and ^TO_ tokens confuse you: there's no ^FROM token
in procmail. Since procmail regexps are case-insensitive by default, ^FROM
just looks for the letters "from" at the start of a line. It can match on
the 'From ' line at the top as well as on the From: header.
Second, a trailing ".*" just wastes space; unlike filename globbing (as Steve
said, regexps are different from filename globbing), there is by default no
anchoring, so looking for "@" is the same as looking for "@" with something
before or after it (or both before and after it).
So if your mail always comes in with 'From ' lines and if they always have
a fully qualified address in them, including an at-sign, then every message
will match ^FROM(_dot_)*(_at_)(_dot_)* --- even if you rewrite as ^From.*@ --
and no mail
will be forwarded by that recipe. Try this (though it can be fooled if
someone includes an at-sign in the comment part of the From: header without
having one in the actual address):
* ! ^From:.*@
It will also catch messages that have no From: header at all.
You don't need to escape the at-sign, and a space after the colon is not a
good idea there; it would trap a message with a From: header like
From:realuser(_at_)site(_dot_)domain
because it has no space immediately after the colon, which technically isn't
even required.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail