On 7/1/2013 2:51 PM, Wietse Venema wrote:
> Noel Jones:
> [Setting the subject to "fax from 555-1212"]
>> Since this isn't real email, it might be sufficient to always add a
>> Subject header, even if one already exists.  And maybe throw away
>> the existing Subject too.
>>
>> I'm pretty sure postfix will only add one header, despite this rule
>> matching multiple headers. If it does add multiple headers, you can
>> try matching /^Message-ID: / or /^From: /, but those aren't required
>> headers either and may not always be present (or just ignore the
>> ugliness -- multiple identical Subject: headers probably won't break
>> anything).
> 
> It's easy enough to ignore existing Subject: lines, but adding
> exactly one requires care.  The bad news is that PREPEND action (in
> access, header_checks, body_checks) will prepend text for each match.
> 
> Adding text once robustly requires changes to Postfix, without
> entering the slippery slope that ends with a Turing-complete language.
> 
> Of all the alternatives that I could think of, EOH pseudo pattern,
> match count options in the regexp/pcre implementation, the only
> change that seems reasonably implementable is to apply header_checks
> to an empty line to signal the end of the message header (which
> means Postfix would have to supply this line when none exists).
> 
>     /^$/ PREPEND Subject: fax from 555-1212
> 
> Then, new safety code would have to be added so that REPLACE, IGNORE,
> etc., won't remove an existing blank line from the input stream.
> 
>       Wietse
> 


Maybe a PREPENDONCE action that only fires once per message?  At any
rate, this new feature doesn't seem to be worth spending much time on.



  -- Noel Jones

Reply via email to