Re: [exim] Outgoing mail : how to remove tags/keywords from …

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Jeremy Harris
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: Re: [exim] Outgoing mail : how to remove tags/keywords from the subjet header ?
On 06/05/2021 01:32, 32.yves.roux--- via Exim-users wrote:
> we have a spam/virus filtering system that add spam score and other info with keywords at the beginning of the subject header
> to inform the end-user and help him write sort-rules in his mail-client.
> Example : {spam: 43} {newsletter} {SPF: pass} {DKIM: No signature}, etc...
>
> But when an end-user answers to that mail we would *remove* all these tags


> I did search and did find how to do this for *incoming* subject header rewrite
> (
> typically sequences like :
> headers_add "New-Subject: {spam}: $h_subject:"
> headers_remove subject
> headers_add "Subject: $h_new-subject:"
> headers_remove new-subject
> }
>
> but I could *not* find something to do this for *outgoing* mail


There are two issues here:
- identify the messages to be operated on
- do the header manipulation

Be aware that ACLs apply to messages being received, which includes
both what you are calling "incoming" and "outgoing". If you do this
operation in ACL you'll need to suitably condition it.

Doing it in suitable routers or transports may be simpler, if you already
have a clear distinction between those use for "incoming" and "outgoing"
messages.


For the "outgoing" modification, you'd be using a similar sequence
of header-change operations, but for the replacement Subject:
instead of creating one by prepending text to the existing one
you'd be creating one using an edited version of the existing one.

Look into the ${sg } string-expansion operator:
http://exim.org/exim-html-current/doc/html/spec_html/ch-string_expansions.html

--
Cheers,
Jeremy