Am 16.12.2014 um 01:09 schrieb Viktor Dukhovni:
On Tue, Dec 16, 2014 at 01:04:29AM +0100, li...@rhsoft.net wrote:
The "-h" option is I think what you're looking for

sounds promising - thank you for the hint!

You'll need to modify the code to process the "IGNORE" action,
rather than print it, and to print unmatched headers

modifiy the postfix code?

Yes, create a custom variant of "postmap".

the difficult thing here is that "grep" in context of multiline headers
don't work that well while "header_checks" does but pipe all the mailfiles
through smtpd is not really a repeatable solution

It is not difficult to use Perl to accumulate folded multi-line
headers into a single string for matching, and then match each
complete header against a list of patterns.

may split the message in two parts (headers and rest) and then fold any line with ident to the previous one would do the trick and fire grep after that

not sure how to identify start of the body because the assumption "two linebreaks" don't work in the example below
___________________________________________________________

Return-Path: i...@quailitybadges.org
Content-Type: multipart/related; type="multipart/alternative";
        boundary="_=aspNetEmail=_f0324f8829c5476db98d844fd8dc30b4"


--_=aspNetEmail=_f0324f8829c5476db98d844fd8dc30b4
Content-Type: multipart/alternative;
        boundary="_=ALT_=aspNetEmail=_f0324f8829c5476db98d844fd8dc30b4"


--_=ALT_=aspNetEmail=_f0324f8829c5476db98d844fd8dc30b4
Content-Type: text/plain;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable

=0D=0A=0D=0ADear Customer, please see attached  Name Badges
___________________________________________________________

The postmap(1) utility comes close, but it prints matching headers
and the action, rather than applying the action and printing any
non-matching headers.

A chimera of postmap(1) and cleanup(8) would do the trick.  I don't
think it is very much code to copy/change

for somebody knowing the programming language and the code :-)

Reply via email to