Re: [Exim] Router condition lookup: line-delimited file cont…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Sheldon Hearn
Date:  
À: exim-users
CC: Tony Finch
Sujet: Re: [Exim] Router condition lookup: line-delimited file contains
On (2003/11/10 14:19), Philip Hazel wrote:

> > The docs suggest that lsearch can't be used in this way, because an
> > lsearch expects the file to contain
> >
> >    key colon [whitespace] value

>
> Value is optional (result is the null string). Colon is optional. From
> TFM:


Ah. I read the debug output incorrectly.

What was failing was the second part of an "and" condition, which tested
for the presence of an X-Spam-Score header.

That header didn't exist yet, because the message had not yet passed
through the ACL.

I've reworked it as follows:

# The router:
#
lookuphost_subject_spam:
  driver = dnslookup
  domains = ! +local_domains
  condition = \
    ${lookup \
      {$local_part@$domain} \
      lsearch{/usr/local/etc/exim/spam_tagging_recipients} \
      {yes} {no} \
    }
  ignore_target_hosts = /usr/local/etc/exim/unroutable-nets
  transport = remote_smtp_subject_spam


# The transport:
#
remote_smtp_subject_spam:
  driver = smtp
  no_delay_after_cutoff
  headers_remove = \
    ${if \
      match {$h_X-Spam-Score:}{\N\+\+\+\+\+\N} \
      {subject} {} \
    }
  headers_add = \
    ${if \
      match {$h_X-Spam-Score:}{\N\+\+\+\+\+\N} \
      {Subject: ***SPAM*** $h_Subject:} {} \
    }


The goal is to allow a list of recipients for whom the Subject line is
manipulated when a message is identified as spam. I already have this
working for local delivery, but that's much easier, since I just use:

# The router:
#
localuser_subject_spam:
  driver = accept
  check_local_user
  local_parts   = /usr/local/etc/exim/spam_tagging_recipients
  condition     = ${if match {$h_X-Spam-Score:}{\N\+\+\+\+\+\N}{1}}
  transport = local_delivery_subject_spam


# The transport:
#
local_delivery_subject_spam:
driver = appendfile
...
headers_remove = subject
headers_add = Subject: ***SPAM*** $h_Subject:

Messing with the Subject line is considered evil, but we do what we must
in the face of lame MUAs.

Thanks for the help.

Ciao,
Sheldon.