On Fri, 23 Feb 2007 11:45:06 -0500 Patrick Baldwin
<Patrick(_dot_)Baldwin(_at_)studsvikscandpower(_dot_)com> wrote:
I've got a strange problem.
It's not strange at all. Sendmail is doing what you tell it to.
I'm forwarding a copy of a user's email to gmail.
Actually, you are piping the entire message (including all original
headers) with a changed "To:" header and added "X-Loop:" header back to
sendmail for delivery.
Note the (including ALL original headers) and be VERY glad you paid
attention during the "X-Loop:" part of procmail class.
This seems to be working fine, except when someone
sends something CC: instead of To:, there ends up
being 2 copies of the email in his local INBOX.
[...]
The other copy has a To: line containing
the gmail address we're forwarding to, and
the same CC: line as the first copy.
The procmail file:
[...]
:0c
* !^FROM_DAEMON
* !^FROM_MAILER
* !^X-Loop: to_gmail
| (formail -t -I"To:
the(_dot_)traveller(_dot_)in(_dot_)black(_at_)gmail(_dot_)com" \
-A"X-Loop: to_gmail" \
) | $SENDMAIL -t
What you have pipes the original message with a new To: header and the
original Cc: header. So, it gets Cc:'d again.
If you'd missed out on adding the X-Loop: you'd get a lot more than one
extra copy.
Try this:
|(formail -i"Cc:" -I"To:
the(_dot_)traveller(_dot_)in(_dot_)black(_at_)gmail(_dot_)com"\
-A"X-Loop: to_gmail"
) |$SENDMAIL -t
-i will preserve the old Cc: header as "Old-Cc:". Use -I if you just want
to drop the Cc: header.
Gerald
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail