Author: Jasen Betts Date: To: exim-users Subject: Re: [exim] Limit the total number of headers in incoming SMTP
messages?
On 2015-03-23, Chris Siebenmann <cks@???> wrote: > We use a commercial anti-spam system behind our Exim-based inbound MX
> gateway that turns out to be unhappy if a message has 'too many' headers
> (where this is an undocumented value of more than 512 headers). I'd like
> to detect and reject these messages in the DATA phase, rather than having
> them accepted, passed to the anti-spam system, and die quietly.
>
> Given that the 'regex' ACL condition is specifically restricted to
> handling a single line, about the only way to do this that I can see
> is to (ab)use Exim's content scanning interface to run a program that
> counts header lines and emits a suitable 'I found bad stuff' message
> when it finds too many headers that the DATA ACL will then use to reject
> the message. This seems a little bit brute force (among other things,
> it means running an external program on every incoming messages).
>
> Can anyone think of a better way to do this?
${listcount:<\n$message_headers}
will tell you how many lines there are in the headers, which is not
quite the same thing, but may be close-enough