procmail
[Top] [All Lists]

Re: Replacing the TO header with email addresses on file

2009-06-25 11:13:09
At 09:28 2009-06-24 +1200, reti(_at_)igrin(_dot_)co(_dot_)nz wrote:
For the past few months procmail has been dealing with TO headers
differently than previously for emails pulled from a file.
[snip]

No, it hasn't.

CODE FOR SENDING EMAILS IN FILE EMAILLIST.TXT
:0
*^To:(_dot_)*GDM(_at_)selectpost(_dot_)com
*^Subject: 2101-2101
! `cat /home/reti/sms/emaillist.txt`

[snip]

Nothing about that recipe would rewrite the To: header. You are merely forwarding it to that address (which is the ENVELOPE address). If any header rewriting was taking place, it would have been your MSA or MTA doing it, and when it was doing it, that was incorrect.

Your problem IS NOT a procmail one. If you really want/need the To: header to be rewritten, procmail can be your solution, but it certainly isn't the problem.

If you want to change the To: (is there really a need?), then you'll need to pipe the message to formail. One way of doing this is:

:0
*^To:(_dot_)*GDM(_at_)selectpost\(_dot_)com
*^Subject: 2101-2101
| formail -I "To: `sed '{:q;N;s/\n/,/g;t q}' /home/reti/sms/emaillist.txt`" \
        | $SENDMAIL `sed '{:q;N;s/\n/ /g;t q}' /home/reti/sms/emaillist.txt`

The sed invocation in there in place of a cat is to deal with the likelyhood that your emaillist.txt file may have multiple addresses separated by newlines - the To: header would expect commas separating them, and the MSA would expect spaces.

FEBRUARY 2009 ­ TO: HEADER REPLACED WITH EMAIL ON FILE
Date: Mon, 09 Feb 2009 17:12:46 -0500
From: "Shane Reti" <sreti(_at_)(_dot_)(_dot_)(_dot_)(_dot_)>
Subject: 1950-1950
To: +18574455615(_at_)sms(_dot_)unwiredalerts(_dot_)com


JUNE 2009 ­ TO: HEADER NOT REPLACED WITH EMAIL ON FILE
Date: Tue, 23 Jun 2009 14:59:41 -0400
To: GDM(_at_)SELECTPOST(_dot_)COM
From:
Subject: 2101-2101

Compare OTHER headers in the before and after messages - such as Received: where the version of the MTA might be shown. This may show you the system change if it was induced by an MTA upgrade.

---
 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 homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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