procmail
[Top] [All Lists]

Re: Auto Reply

1996-09-19 17:32:14
    > I have been using procmail for one year. It did a great job. I
    > thank the author sincerely for bringing so much convenience to
    > me. However I never get the auto-reply function working.

    > Somebody helped me once but the result was not so satisfactory
    > because it did not get the right address of the sender to a group
    > list.

Let me get this straight:

You have a mailing list which may munge the headers in strange and
wonderful ways, and you want someone to help you, without knowing any of
the details of the header munging?

    > Anybody out there has a script that handles this task or has a
    > good idea about it?  Thank you in advance about it!

There are lots of messages in the archives with the answers to this.
But, none of them may work unless a sample from your suspect mailing
list is provided for the many experts on this list to review.

In any case, there are two "standard" ways to get the best "reply to"
address: (a) use "formail", which uses the headers, or use procmail
recipes, which also uses the headers.  So, if the mailing list munges
the headers in a non-standard way, the *only* way you'll be able to
generate a reply is by applying some special heuristic, peculiar to this
suspect list.

The (a) method is this:

    FROM=`formail -rtzxTo:`

    which generates the headers for a reply, based on the current mail
    message, and extracts the resulting To: address.

The (b) method is (originally from David Tamkin), but spruced up by me:

    # Get the best FROM
    :0
    * ! ^Reply-to: *\/[^ ].*
    * ! ^From: *\/[^ ].*
    * ! ^Sender: *\/[^ ].*
    * ! ^From +\/[^ ]+
    * ! ^X-Envelope: *\/[^ ].*
    { FROM=nobody }
    :0E
    { FROM=$MATCH }

    # Get the "friendly" name part of the address, by
    #  1. removing any bracketed address part, 
    #  2. removing any unbracketed address part,
    #  3. unquoting any text
    #  4. unparenthesizing any text
    FRIENDLY=`echo $FROM | sed -e 's/ *<.*> *//' \
                               -e 's/ *[^ ][^ ]*[\(_at_)\!][^ ][^ ]* *//' \
                               -e 's/"\(.*\)"/\1/' \
                               -e 's/(\(.*\))/\1/'`
    FRIENDLY=${FRIENDLY:-$FROM}

The advantage of (b) is that you can also get, seperately, the
"friendly" part of the reply address.

But, neither of these standard ways will work if the list doesn't use
the usual conventions for mail forwarding.

You'll have to provide a sample message from the suspect mailing list,
and the recipe (of yours) which fails to auto-reply, before anyone can
really help you out.

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

<Prev in Thread] Current Thread [Next in Thread>
  • Auto Reply, Jun Tang
    • Re: Auto Reply, Alan K. Stebbens <=