Re: [exim] Removing all headers with the same prefix

Pàgina inicial
Delete this message
Reply to this message
Autor: Heiko Schlittermann
Data:  
A: exim-users
Assumpte: Re: [exim] Removing all headers with the same prefix
Stefan Unterweger <28443.kr@???> (Di 18 Apr 2017 20:07:33 CEST):
> I want to scrub certain kinds of headers for all incoming messages so


> I have tried to find some kind of string expansion which would give me a
> list of all message headers which start with my chosen prefix, or some
> other kind of trick to get similar results, but so far, I didn’t find
> anything. Of course I could list all possible combinations of ‘Spam-…’
> that I can think of, but this is kind of a losing battle…


As part of my data acl I use:

     warn  set acl_m_headers_remove \
               = ${filter {MESSAGE_HEADERS}{match{$item}{\N^x-(?:ius|hh)-\N}}}


to remember all headers matching /^x-(ius|hh)-/i in an ACL variable.
The MESSAGE_HEADERS macro is:

MESSAGE_HEADERS  = \
          ${lc:${sg\
           {${map\
             { <\n ${sg {$message_headers_raw}{\N\n\s+\N}{ }} }\
             {${extract{1}{:}{$item}}}\
             }\
           }\
           {\N\n\N}\
           {:}\
           }}



The actual removal is done in the transport as follows:

    begin transports


    smtp:
        driver = …
        headers_remove = $acl_m_headers_remove
        headers_add = $acl_m_headers_add



But, please note, this solution has not been reviewed for a long time, but
it is in use currently and seems to work.


    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
-- 
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
 gnupg encrypted messages are welcome --------------- key ID: F69376CE -
 ! key id 7CBF764A and 972EAC9F are revoked since 2015-01 ------------ -