procmail
[Top] [All Lists]

Re: Rewriting the headers

2000-07-04 20:37:24
Hermann wrote,

| I need to rewrite the from: and reply-to: header from a message...
| 
| The original portion should be removed and a new one inserted (to avoid an 
| auto-reply from a third party ISP - the paging company - being returned to 
| the original sender).
| 
| I tried this:
| 
| :0
| * ^TOemail@(mydomain1|mydomain2)\.com
| * ! ^X-Loop: looping(_at_)mydomain1\(_dot_)com
| | formail -k -X "From:" -X "Subject:" \
|       -I "To: nextelnumber(_at_)page(_dot_)nextel(_dot_)com" -X "To:" \
|       -I "X-Loop: looping(_at_)mydomain1(_dot_)com" -X "X-Loop:" \
|       -I"Reply-To: nobody(_at_)mydomain1(_dot_)com" -I"Precedence: junk" \
| | $SENDMAIL $SENDMAILFLAGS -t

| the "nextelnumber(_at_)page(_dot_)nextel(_dot_)com" is the third party e-mail 
(my pager)
| the "nobody(_at_)mydomain1(_dot_)com" is a "/dev/null" mailbox in my domain, 
where the 
| auto-reply will be returned to

Take out all those -X options.  All it takes is one -X or -x and you've wiped
out every header not matching a -x or -X option.  Since you didn't include
-X Reply-To: nor -X Precedence:, those two headers were lost and the -I
options for them went to waste.  If it is important to get rid of all the
other headers (and since you're forwarding to a pager, it could be), then
keep the -X options you have but add -X options for Reply-To: and Precedence:

  | formail -k -XFrom: -XSubject: -XPrecedence: -XTo: -XReply-To: -XX-Loop: \
        -I "To: nextelnumber(_at_)page(_dot_)nextel(_dot_)com" \
        -A "X-Loop: looping(_at_)mydomain1(_dot_)com" \
        -I"Reply-To: nobody(_at_)mydomain1(_dot_)com" -I"Precedence: junk" \
  | $SENDMAIL $SENDMAILFLAGS -t

... or just for Reply-To: and forget about using Precedence: entirely:

  | formail -k -XFrom: -XSubject: -XReply-To: -XTo: -XX-Loop: \
        -I "To: nextelnumber(_at_)page(_dot_)nextel(_dot_)com" \
        -A "X-Loop: looping(_at_)mydomain1(_dot_)com" \
        -I"Reply-To: nobody(_at_)mydomain1(_dot_)com" | $SENDMAIL 
$SENDMAILFLAGS -t

If your pager doesn't honor "Precedence: junk" as a reason not to send an
autoresponse, then there is no point to adding a Precedence: header.  (Of
course, so far we don't know, because without -XPrecedence: there is no
Precedence: header reaching the pager.)

Also, you generally should use -A rather than -I with X-Loop: to preserve
other X-Loop: lines added at other places (they, too, would want to know if
the message came back to them again); I can see that this case might be an
exception, though, where -I wouldn't hurt, but I'd still recommend -A.

Now let's just hope that the pager sends its autoresponse to Reply-To: and
not to From: or From_.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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