Re: [exim] Detecting presence of custom header in ACL

Top Page
Delete this message
Reply to this message
Author: Todd Lyons
Date:  
To: James Price
CC: exim-users
Subject: Re: [exim] Detecting presence of custom header in ACL
On Tue, Oct 26, 2010 at 9:16 AM, James Price <james@???> wrote:
> find a way to get it to work. Long story short, in a given SMTP time
> ACL,
> as part of my final accept I might add a custom header for
> debugging/tracking purposes. What I would like to do is detect if the
> header already exists prior to adding it. I'm assuming I can use a
> condition that detects if $h_X-HEADERNAME is present and if not
> add_header.


Here's an example of how I use it:

  accept  condition      = ${if def:header_x-atmail-account:{yes}{no}}
          hosts          = +iv_live_hosts
          set acl_c_webmail = 1


Pay close attention to the fact that there are no curly braces around
the def:header_$HEADER part.

Of course you could do anything you wanted to aside from setting that
acl, including adding a header. Make sure you think about the inverse
though. What do you want to do if that header _DOES_ exist already?
If nothing, you are in good shape, but if you need to do something
different, you have to make a second check and change the condition
slightly. Also note that I have accept for the verb. If you're just
testing for presence, that would probably mean a "warn" is called for
instead.

--
Regards...      Todd
I seek the truth...it is only persistence in self-delusion and
ignorance that does harm.  -- Marcus Aurealius