procmail
[Top] [All Lists]

Re: Rewriting the headers

2000-07-04 21:54:59
Hermann followed up,

| bad news for us... the pager company is ignoring the reply-to field...
| So I rewrited again the recipe (and it is working ok):
| 
| :0
| * ^TOpager@(mydomain1|mydomain2)\.com
| * ! ^X-Loop: looping(_at_)mydomain1\(_dot_)com
|    | 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"From: nobody(_at_)mydomain1(_dot_)com" \
|          -I"Reply-To: nobody(_at_)mydomain1(_dot_)com" | $SENDMAIL 
$SENDMAILFLAGS -t

Well, if it ignores Reply-To:, don't bother adding it:

  :0
  * ^TOpager@(mydomain1|mydomain2)\.com
  * ! ^X-Loop: looping(_at_)mydomain1\(_dot_)com
  | formail -k -XFrom: -XSubject: -XTo: -XX-Loop: \
          -I "To: nextelnumber(_at_)page(_dot_)nextel(_dot_)com" \
          -A "X-Loop: looping(_at_)mydomain1(_dot_)com" \
          -I"From: nobody(_at_)mydomain1(_dot_)com" | $SENDMAIL $SENDMAILFLAGS 
-t

| Now it raises another problem: is it possible to copy the (original) from: 
| in the body?

Yes, but there's a question; do you want to keep a copy of the message at the
account where procmail is running?  I'll assume yes, and I'll assume that you
don't want the From: line added to the body of the copy that stays on the
host.  But since you didn't have a `c' on the original, I'm guessing you had
already saved a copy above that recipe.

  :0c # don't use `c' if you've already saved the local copy
  * ^TOpager@(mydomain1|mydomain2)\.com
  * ! ^X-Loop: looping(_at_)mydomain1\(_dot_)com
  {
   :0bfw # filter only the clone
   * ^\/From:.*
   | sed "1i\\
$MATCH\\
\\
"

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

Alternatively, will the pager display an Old-From: header?  Then you can
store the original From: information there:

  :0c # same comment about the `c', and note lower-case -i for From:
  * ^TOpager@(mydomain1|mydomain2)\.com
  * ! ^X-Loop: looping(_at_)mydomain1\(_dot_)com
  | formail -k -XFrom: -XSubject: -XTo: -XX-Loop: -XOld-From: \
          -I "To: nextelnumber(_at_)page(_dot_)nextel(_dot_)com" \
          -A "X-Loop: looping(_at_)mydomain1(_dot_)com" \
          -i"From: nobody(_at_)mydomain1(_dot_)com" | $SENDMAIL $SENDMAILFLAGS 
-t


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