procmail
[Top] [All Lists]

Re: failed attempts to forward mail from one email to another with changes

2001-08-20 19:10:48
Errol Casey tried this code (except that I had to take out some spaces to
keep my mail client from wrapping),

| :0 c
| {
|  | formail -I"To: email(_at_)newcompny(_dot_)com" -A"X-Loop: 
email(_at_)newcompany(_dot_)com" \
|  | sed -e 's/internal/external/' \
|  | sendmail -t
| }

Your syntax is wrong.  Short answer: lose the braces.  (I'm trusting that
"newcompny" without the A is only in your illustration to us and not in the
code you tried.)

| I believe I tried with and without a "conditon" before the
| brace. The condition I had when used was
|
| * !^X-Loop: email(_at_)newcompany

As well you should; an X-Loop: line won't do you any good if you don't have
anything looking to see whether one is already there or not.  Also, it's not
a good idea here to feed to sendmail -t, because there might be a Cc: header
on the message, and the recipient(s) named there will get another copy.
Finally, procmail will have set $SENDMAIL to the path of your MTA, and
there's a chance that even if its basename is "sendmail" it won't be in
$PATH, so unlike what Philip and I tell people about other executables,
$SENDMAIL is the one that should be invoked by a variable instead of a
basename:

 :0c
 * ! ^X-Loop: email(_at_)newcompany\(_dot_)com
 | formail -I "To: email(_at_)newcompany(_dot_)com" -A "X-Loop: 
email(_at_)newcompany(_dot_)com" \
   | sed -e 's/internal/external/' \
   | "$SENDMAIL" $SENDMAILFLAGS email(_at_)newcompany(_dot_)com

One other suggestion: use -i instead of -I to preserve the original To:
information in an Old-To: line in case the end recipient wants to see it,
but stick with -I if you specifically want to hide the original addressee
from the final recipient.


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