On Wed, 20 May 1998, Eric Hilding wrote:
Although I've implemented many new recipes to better thrash spam,
I'm still having difficulty with the indented "for" <addresshere>
or "for" (addresshere) lines to axe out certain junk.
I think these two condition lines can replace the four in your example.
* ^[^!-~]*((.*[^!-~])?)for )?[^ ]+(_at_)fastmail\(_dot_)com[>)]?;[^;]*$
* ! ^[^!-~]*((.*[^!-~])?for
They should work on one-line rcvd-fields or the sort with breaks. But the
real problem is they match on any rcvd fields in the header, not just the
topmost field. You might want to just apply that to the topmost field, but
I don't know how to do that strictly within procmail. I use the following
to set the 'for' address into a variable. I've been testing it for a
little while now (on three different systems) and it seems to work fine.
It gets the top received field, then strips it down to an address that
precedes a semi-colon, rather than looking for what follows 'for'.
rcvd_for=`formail -ureceived -zxreceived \
| sed -e 's/[>)]*;[^;]*$//' \
-e 's/^.*[ <(]//' \
-e '/^[^(_at_)]*$/d' \
Now you can test the contents of the var in your recipe.
* rcvd_for ?? @fastmail\.com
* ! rcvd_for ?? legitaddress(_at_)fastmail\(_dot_)com