procmail
[Top] [All Lists]

Re: More email middleman (LONG)

1999-05-03 21:16:43
On 3 May 1999, tomcat(_at_)visi(_dot_)com <tomcat(_at_)visi(_dot_)com> wrote:
[...]
2) .procmailrc looks thru body of email and matches on html form
variables, like "Contact site Admin".  The following code works
($ADMIN holds email address):

:0 Bc
      * Contact site Admin
      | formail -cz -I "From: blackh(_at_)visi(_dot_)com" \
      | $SENDMAIL -oi $ADMIN

question:  should I be using 
-I "Reply-To: blackh(_at_)visi(_dot_)com" instead of
-I "From: blackh(_at_)visi(_dot_)com" (or in addition to it?)?

    "Reply-To:" is the address you want the recipient to use when
replying (surprise...).  As long as this is the same as the address in
"From:", you can omit the "Reply-To:".

I swear to god my MAN page for sendmail doesn't say what the "i" in
-oi stands for, so I can't check the syntax.

    It tells sendmail that dots at the beginning of a line don't have
any special meaning.  You want this.

[...]
3) Next a log file is written to and the date and subject noted:

:0 wci:
* ^Subject:[    ]\/[^   ].*
| (echo "`date` -Subject:" $MATCH  >> $HOME/BHmail_log)

    Minor improvement:

        :0 wci:
        * ^Subject:[    ]+\/.*
        | echo "`date` -Subject:" $MATCH  >>$HOME/BHmail_log

(the brackets [...] contain a space and a tab).

question: suppose I also want to log who the originator is, the person
who types in his email address on my web page?  Do you do multiple
matches in the same recipe, or do you use seperate recipes?

    It's easier to use separate recipes.

[...]
Would I strip out the "X-Mailto-Comment:" before the :0 wci: recipe
like this

:0
* ^X-Mailto-Comment:[    ]\/[^   ].*
 ORIG = $MATCH

and then augment the :0 wci: recipe like this

:0 wci:
      * ^Subject:[    ]\/[^   ].*
      | (echo "`date` $ORIG -Subject:" $MATCH  >> $HOME/BHmail_log)

It doesn't work .....

    Try this instead:

        :0
        {
            :0
            * ^X-Mailto-Comment:[       ]+\/.*
            { ORIG=$MATCH }

            :0 wci:
            * ^Subject:[        ]+\/.*
            | echo "`date` $ORIG -Subject:" $MATCH  >>$HOME/BHmail_log
        }

4) The ADMIN gets his mail and replies to it - it correctly goes to my
psuedo mail server at blackh(_at_)visi(_dot_)com(_dot_)  Here is the header 
from the
reply that the psuedo mail server keeps:

==============================================
Return-Path: <tomcat(_at_)visi(_dot_)com>
Delivered-To: blackh(_at_)yuck(_dot_)net
Posted-Date: Mon, 3 May 1999 15:17:56 -0500 (CDT)
Subject: Re: HawkWeb: test1
To: blackh(_at_)visi(_dot_)com
=======================================
Note that the "X-Mailto-Comment:" field is gone.  Formail and
Sendmail passed it along to ADMIN - it showed up in the header ADMIN
received. Who stripped it off?

    ADMIN's MUA, of course.  If I send you a message with, say, a
"X-Pgp-Fingerprint:" header and you reply to it, I don't expect you to
echo the header back, claiming it's your fingerprint. :-) If you want
ADMIN to include the "X-Mailto-Comment:" stuff in his reply you have to
configure his MUA/editor/whatever to do that.

Somebody told me to include a "From:" in the email my psuedo server
sends out, I also see "Reply-to" and now "Return-Path:"  Which one is
"correct" to indicate where replies go?

    Simply put:

(1) "From:" is sender's address; if there is no "Reply-To:", replies
    will go to that address;

(2) "Reply-To:" is the preferred address for replies, if different from
    the one in "From:"; it can coexist with "From:", and it will take
    precedence over it;

(3) "Return-Path:" is added by the MTA at the final delivery stage, and
    it's used for sending back error messages; don't mess with this.

    So you probably want to add a "From:" (so that the recipient knows
who sent the message...), and also a "Reply-To:" if you want replies to
go to a different address from that in "From:".

5) Finally, I want the mail server to send the email replied to by
ADMIN to the person who started this mess, the web page form filler
outer.  His email address should be in "X-Mailto-Comment".  I want the
mail server to bail out at this point, so any more email exchange via
reply goes between the web page filler outer and ADMIN.

    Add both addresses to the "Reply-To:" in the messages sent to ADMIN.

Since Return-Path: <tomcat(_at_)visi(_dot_)com> is correct, I should only 
need to
change the To towit:
[...]

    Like I said, don't mess with "Return-Path:".

    Regards,

    Liviu Daia

-- 
Dr. Liviu Daia               e-mail:   Liviu(_dot_)Daia(_at_)imar(_dot_)ro
Institute of Mathematics     web page: http://www.imar.ro/~daia
of the Romanian Academy      PGP key:  http://www.imar.ro/~daia/daia.asc

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