On 2021-08-26, nb via Exim-users <[email protected]> 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.

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to