On 01 Jul 2013, at 12:09 , Daniel L. Miller <[email protected]> wrote:

> On 6/28/2013 4:34 PM, Noel Jones wrote:
>> On 6/28/2013 5:39 PM, Daniel L. Miller wrote:
>>> Does anyone know of a tool that will let me modify the subject line
>>> of all emails that pass through it?  I would call it via a transport
>>> map.
>>> 
>>> My application - we just switched to a new email-to-fax service.  As
>>> part of their security implementation (THEIRS, not mine!) they
>>> require all emails sent to them to contain our own fax number.  I
>>> want to automate this step so I don't have to hear from my users.
>>> 
>> 
>> http://www.postfix.org/postconf.5.html#smtp_header_checks
>> 
>> Add this to master.cf something like this:
>> (or if you already use a custom master.cf transport, add the -o
>> override to that entry)
>> 
>> # master.cf
>> # fax_service is a copy of the smtp...smtp transport
>> fax_service ... smtp
>>   -o smtp_header_checks=pcre:/etc/postfix/smtp_fax_header
>> 
>> # smtp_fax_header
>> /^Subject: / REPLACE Subject: fax from 555-1212
>> 
> 
> That ALMOST works - thanks!  The problem - I have to have SOMETHING in the 
> subject otherwise it doesn't happen with this matching rule. Is it possible 
> to ADD a Subject: header when none is present?

Perhaps procmail/formail then

(with procmail is easiest)

:0
* ^TO_faxservice@faxcompany\.com
  {
    SUBJECT=|formail-xSubject:

    :0 hfw
    | formail -i "Subject: 555-1234 $SUBJECT"
  }


I invoke procmail like this

/etc/postfix/main.cf
  virtual_transport = procmail

/etc/postfix/master.cf
  procmail  unix  -       n       n       -       -       pipe -o 
    flags=uhFORD 
    user=vpopmail argv=/usr/local/bin/procmail -t -m USER=${recipient} 
EXTENSION=${extension} /usr/local/etc/procmailrc.common

But it shouldn't be much of a trick to fire it with a custom recipe file on the 
outbound mail. It might be a little expensive, however.

-- 
Stone circles were common enough everywhere in the mountains. Druids
built them as weather computers, and since it was always cheaper to
build a new 33-Megalith circle than to upgrade an old slow one, there
were generally plenty of ancient ones around --Lords and Ladies

Reply via email to