procmail
[Top] [All Lists]

More email middleman (LONG)

1999-05-03 14:54:06
Forgive me for continuing to flog this dead horse,
but I remain mystified in completing a simple mail
server.  This post is long - thank you in advance 
for your patience.  I have substituted the name
"purple" everywhere for the actual psuedo email 
server address: tomcat is valid and is mine.

Here is the general scheme:

1) web page generates email to blackh(_at_)visi(_dot_)com,
includes web page user's typed in email address
in "X-Mailto-Comment:" field.  Email sent to
blackh(_at_)visi(_dot_)com

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?)?

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.

Here is the header of the email that comes into the
server from the web page and gets send to the ADMIN:
============================================
Return-Path: <blackh(_at_)tiny(_dot_)net>
Delivered-To: tomcat(_at_)yuck(_dot_)net
Delivered-To: blackh(_at_)yuck(_dot_)net
Posted-Date: Mon, 3 May 1999 15:17:17 -0500 (CDT)
Date: Mon, 3 May 1999 15:17:16 -0500 (CDT)
X-Ident-From: unknown(_at_)kyle4(_dot_)mmm(_dot_)com
(http_referer=http://www.visi.com/~blackhawk
s/contactus/contact.html)
Subject: HawkWeb: test1
To: blackh(_at_)visi(_dot_)com
Precedence: bulk
X-HTTP-Referer: http://www.visi.com/~blackhawks/contactus/contact.html
X-Mailto-Comment: tomcat(_at_)visi(_dot_)com
Sender: blackh(_at_)tiny(_dot_)net
=============================================
Note that all incoming email to this account goes thru
a main procmail spam filter at yuck.net.  tiny.net
must be some sort of alias.  Mail sent to blackh at
any of these, yuck.net, tiny.net, or visi.com works.


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

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

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?

I have the format

:0
* ^Subject:.*HawkWeb
* !^Subject:.*Re: HawkWeb
   {
     :0 Bc
      * Risk Coordinator
      | formail -cz -I "From: blackh(_at_)visi(_dot_)com" \
      | $SENDMAIL -oi $RISK

      :0 Bc
      * Registrar U8-U11
      | formail -cz -I "From: blackh(_at_)visi(_dot_)com" \
      | $SENDMAIL -oi $REGISTRAR_U8_U11

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

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

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

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?

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?

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.

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


:0
* ^X-Mailto-Comment:[    ]\/[^   ].*
  ORIG = $MATCH
| formail -cz \
| $SENDMAIL -oi $ORIG

=================================
I know how difficult it is to understand someones
code gone wrong, but I have put about 3 weeks into
this so far and am certain my understanding of all
of this is weak.  I appreciate anyone able to fill
me in on all or parts of this.  To anyone wishing
to comment "you're crazy", I assure you I already
know  ;)

Regards

Tom            tomcat(_at_)visi(_dot_)com









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