Re: [exim] Subject rewriting

Startseite
Nachricht löschen
Nachricht beantworten
Autor: nb
Datum:  
To: exim-users
Betreff: Re: [exim] Subject rewriting
Le 2021-09-01 01:54, Jasen Betts via Exim-users a écrit :
> On 2021-08-26, nb via Exim-users <exim-users@???> wrote:
> > Hi,
> >
> > I need to change the subject when the message is considered as spam,
> > *and* when there is an SPF problem.
> >
> > I use the following method:
> >
> > 1 - for SPF:
> >      # remove old subject
> >      remove_header=Subject
> >      # create a new subject
> >      add_header = Subject: *** SPF Error *** $rh_Subject:

> >
> > 2 - for SPAM:
> >      # remove old subject
> >      remove_header=Subject
> >      # create a new subject
> >      add_header = Subject: ***SPAM (score: $spam_score)*** $rh_Subject:

> >
> > It works fine when either of these two cases occur.
> > But when both occur at the same time, I don't get the expected result.
> > In this case, I get two "Subject" headers.
>
> One way would be to build up the prefix in an ACL variable.
>
> # 1 - for SPF:
>       # add this to subject
>       set acl_m_subj_prefix = $acl_m_subj_prefix *** SPF Error *** 

>
> # 2 - for SPAM:
>       # add this to subject
>       set acl_m_subj_prefix = $acl_m_subj_prefix ***SPAM (score: $spam_score)*** 

>
>
>       warn
>         condition = ${if!eq{}{$acl_m_subj_prefix}}
>         logwrite = subject rewritten
>         # remove old subject
>         remove_header=Subject
>         # create a new subject
>         add_header = Subject: $acl_m_subj_prefix $h_Subject:
>     # discard the variable
>     set acl_m_subj_prefix =

>
> > Furthermore, would it be better to use $h_header?
>
> If your exim configuration supports UTF-8, then yes.
> (headers_charset setting in main configurarion)
>
> --
> Jasen.


Thanks Jasen.
Nice solution.
I had found one using a local variable, but this one is cleaner and
better. I'll use it.

Noury