procmail
[Top] [All Lists]

Re: Newbie needs help

2003-02-06 14:50:41
At 12:20 2003-02-06 -0800, Paul Tram wrote:
>         @somemailinglist\.com|\
>       @@)

I'm curious, but what the hell is the @@ for ?

[snip - bunches of inverted from lines]

If it floats your boat. As you add qualifiers to the expressions, you're really going to want to combine them so that you don't hose the delimiting regexp when you've got thirty copies of it in your recipe.

> But From:'friend(_at_)aol(_dot_)com(_dot_)cn' will not go to Spam.

So how would I go about processing such an email?

One possibility is after after the addresses, specify:

        ([^-_\.a-z0-9]+|$)

that is, the termination of the domain portion must be followed by a character which is otherwise not permitted to be part of a domain specification (numbers, letters, dash, underscore, and dot (as a hostname separator) should be the lot, but don't take my word for it - check the DNS RFCs to be sure). Or you could invert that: it must be followed by a character which ISN'T in the allowed character set. The allowed character set is considerably smaller and therefore much easier to express as an inverted class.

Technically, one should ensure that the leading wildcard doesn't over-match as well (something not touched upon, and often ignored):

* ! ^From:(_dot_)*someaddress(_at_)domain\(_dot_)tld

would match "notsomeaddress(_at_)domain(_dot_)tld" just as it would match "someaddress(_at_)domain(_dot_)tld(_dot_)com(_dot_)tw", or "joe(_dot_)bob(_at_)domain(_dot_)tld" when your expression is "bob(_at_)domain(_dot_)tld".

The following should work (you might need to expand upon the lead characters, but these are the ones that pop to mind as regularly occurring at the beginning of an address - the expression should be is equally valid for recipient addresses, which is why a comma is in the character class when you wouldn't expect to see it in a From: specification):

* ! ^From:.*[   <,\(]someaddress(_at_)domain\(_dot_)tld([^-_\.a-z0-9]|$)
                    ^^^^^^^^^^^^^^^^^^^^^^^

Replace the address portion with a parenthesized OR series, then the beginning and end regexp portions would be shared by all of the addresses.

There are other ways to accomplish this, but the above springs to the top of my head.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


_______________________________________________
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>