procmail
[Top] [All Lists]

Re: Modify To: field when forwarding email

2002-05-10 14:04:58
At 11:54 2002-05-10 -0300, Jean-Rene Cormier did say:
I want to forward a copy of the email I receive from a certain address
to another email and change the To: field to that new address.

but when I receive the email the To: field is set to my current email
and I want change it to otheremail(_at_)someotherplace(_dot_)com

That's because all you're doing is a simple forward - which is effectively BCC'ing the address and sending it there. Do you want to change cc:'s as well (or eliminate them)? Have you considered what if the To: was a mailing list, and you were originally Cc'd or Bcc'd (not in THIS individual case obviously, because the From: is a specific user)?

and also how do I put more than one email in the ^From. line? Can I put
more than one or do I have to make 2 separate entry?

Use an OR operator with parenthesis around the conditional. You should also be escaping literal dots, as they're normally a wildcard.


:0c
* 
^From.*(someemail(_at_)someplace\(_dot_)com|someotheremail(_at_)someotherplace\(_dot_)com)
| formail -I "To: otheremail(_at_)someotherplace(_dot_)com" -I "Cc:" | \
        $SENDMAIL otheremail(_at_)someotherplace(_dot_)com

If you want additional addresses on that forward, tack them on with a separating space after the one that is there already.


In a regular forward operator, like you had (which does nothing with the headers), you'd tack additional addresses like so:

:0
! addr1(_at_)domain(_dot_)tld addr2(_at_)domain(_dot_)tld etc

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

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