procmail
[Top] [All Lists]

Re: Bad Return addresses.

1996-09-06 23:07:09
wotan(_at_)netcom(_dot_)com wrote,

| I would like to do two things with this mail.
|
| The first is to have procmail respond to any mail from
| user(_at_)popd(_dot_)netcruiser at user(_at_)ix(_dot_)netcom(_dot_)com(_dot_) 
 The other thing I would like
| to do is correct the bad address and pass the message along to the rest of
| my rc's for proper filtering.

 :0fwh
 * ^From:\/(_dot_)*(_at_)popd\(_dot_)netcruiser
 * MATCH ?? ()\/[-a-z0-9_.]+@
 | formail -I "From: ${MATCH}ix.netcom.com" \
           -I "Reply-To: ${MATCH}ix.netcom.com"

If your version of procmail is too old to redefine $MATCH in the middle of
a recipe,

 :0
 * ^From:\/(_dot_)*(_at_)popd\(_dot_)netcruiser
 {
  POPDSENDER=$MATCH

  :0fwh
  * POPDSENDER ?? ()\/[-a-z0-9_.]+@
  | formail  -I "From: ${MATCH}ix.netcom.com" \
             -I "Reply-To: ${MATCH}ix.netcom.com"
 }

| I am assuming that this will handle the first part (but am not really
| sure):
|
| :0
| * ^From:.*popd.netcruiser
| {
| IXEN=`$FORMAIL -zrx To:| sed -e 's/@.*//'`

That requires formail, sed, and a shell.  My suggestion above uses only
formail.

|       :0
|       |($FORMAIL -r -I"To: $IXEN(_at_)ix(_dot_)netcom(_dot_)com"\
|               -I"From: Wotan's Auto-Responder <wotan(_at_)netcom(_dot_)com>"\
|                 -A"Precedence: junk"                            \
|                 -A"X-Loop: $LOOP"                               \
|                 -I"Subject: Your From line needs to be fixed";        \
|                 cat $PMDIR/instruct )                            \
|              | $SENDMAIL -oi -t

That could stay the same, but you can drop the -I"To: ..." because with
the incoming Reply-To: replaced, formail -r will get a correct To:.

| }

However, I suggest changing the subject of your autoresponse to "Your From:
line needs to be fixed", because "From line" sounds like a reference to the
UNIX From_ line, not to the RFC822 From: header.

| Now is it possible to have formail correct the bad from address and pass
| the message on to the rest of my filters?

Yes, as above.

| Or would I be better off telling the Netcruiser that their mail can not be
| processed by me due to the bad from line, and that they should resend
| after making the correction?

That's up to you.  Some people will figure that if you fix it for them,
then what they're already doing works well enough and they won't fix it for
themselves.

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