Re: [exim] Add x-header based on subject?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Heiko Schlittermann
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] Add x-header based on subject?
Alex Hargrove <ahargrove@???> (Di 10 Dez 2013 19:02:44 CET):
> I have a need to add "X-Sophos-SPX-Encrypt: yes" to the header on outbound messages, but only if the message contains a certain string anywhere in the subject line such as "spxencrypt". In addition to adding the header, I want to have "spxencrypt" stripped off the subject line as well. Is this possible with exim? How?


There are generic transport options

    headers_add
    headers_remove



Here is a simple config file I used for testing:

    echo -e 'Subject: fobar\n\nhi\n' | exim -C `pwd`/test.conf foo@localhost
    echo -e 'Subject: fobar sbxencryptGo\n\nhi\n' | exim -C `pwd`/test.conf foo@localhost


======8<---------------------------

spool_directory = /tmp/exim-spool
exim_user = <your non-root-user>
exim_group = <your non-root-group>

begin routers

all:
    driver = accept
    transport = mangle


begin transports

mangle:
    driver = appendfile
    file = /tmp/mbox
    headers_add = Subject: ${sg{$h_subject:}{\N\s?spxencrypt\s?\N}{ }}\
                  ${if match{$h_subject:}{spxencrypt}\
                    {\nX-Sophos-SPX-Encrypt: yes}{}}
    headers_remove = subject


------->8============================

The routers have headers_add and headers_remove options too.

    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: 7CBF764A -
 gnupg fingerprint: 9288 F17D BBF9 9625 5ABC  285C 26A9 687E 7CBF 764A -
(gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2  7E92 EE4E AC98 48D0 359B)-