procmail
[Top] [All Lists]

Re: old forwarding question

1996-12-11 17:40:41
On Wed, 11 Dec 1996, Chin Fang wrote:

    > Why not just change them to:
    > 
    > :0
    > * ^T[O|o]: gonzo(_at_)me(_dot_)com
    > ! realaddress(_at_)blah(_dot_)com
    > 
    > :0
    > * ^T[O|o]: alonzo(_at_)me(_dot_)com
    > ! realalonzo(_at_)xxx(_dot_)com
    > 
    > :0
    > * ^T[O|o]: fozzie(_at_)me(_dot_)com
    > ! realfozie(_at_)yyy(_dot_)com

Chin Fang,

Sorry, but this doesn't really help.  First, by default, procmail does
case-insensitive matching.  You must use the "D" flag to enable
case-sensitive matches.

So, 

    :0
    * ^To: foo

will match "To: foo", "TO: foo", and "to: foo".

But, these recipes also lack much flexibility.  What happens for mail
addresses like this:

    To: (Gonzo The Great) gonzo(_at_)me(_dot_)com

or even:

    To: gonzo, alonzo, fozzie

    > Almost any mailer that I know of (admitted not many, only elm, Mail, 
mailx)
    > puts a space between the : and the first character of the recipient
    > address.  So the above should be sufficient for you and no one
    > will get the same msg twice.

A better solution is to allow for arbitrary "stuff" between the header
and the address being matched.  This allows for the humans to add
comments to their email addresses:

    To: (The Worlds Greatest Email Junkie) gonzo(_at_)me(_dot_)com

    To: Alan K. Stebbens <aks(_at_)sgi(_dot_)com>

and what about:

    To: "The Stree Stooges": larry, moe, currly;

Here is a general purpose recipe condition to match $ADDR, properly
taking into account the presence of comments or other address quirks:

    * $ ^TO_$ADDR

See?  Isn't this easy?

There is a general axiom for writing any communications protocol (and
this is exactly what email and related filters are):

   "Be generous in what you accept, and stringent in what you send".

You should not rely on well-mannered mail user agents (MUAs) to properly
format the mail in order to have your recipe function properly.

When I write any programming code, I try to think of the worst thing
that can happen and then plan for that possibility.

G'luck.
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

<Prev in Thread] Current Thread [Next in Thread>