Re: [exim] $header_* not defined in router?

Pàgina inicial
Delete this message
Reply to this message
Autor: Carlo Wood
Data:  
A: Graeme Fowler
CC: exim-users
Assumpte: Re: [exim] $header_* not defined in router?
On Mon, Apr 02, 2007 at 08:06:09PM +0100, Graeme Fowler wrote:
> When called as verification from a RCPT ACL this is correct, yes.


I don't see debug output for non-verification, shouldn't the last
time it passes through the router show that the header is present?

Can I use debug_print to print a header, ie:

debug_print = "content of header: $header_to:"

Someone on IRC says that is not possible (and it prints indeed
an empty string), but I am not sure that it prints an empty
string because the header is not known yet or because the $header_to:
is not expanded when used inside a debug_print.

> > Thus, you CANNOT use $header_*: in router definitions.
>
> Yes you can. When they're called appropriately, at the right time -
> which in order to check stuff sent as part of DATA is, self-evidently,
> either in the DATA ACL or any time after that.


I am very confused now :(.

I want to route a message based on the existance of a header,
how can I make routing decisions inside the DATA ACL?

Also, I tried to use debug_print in an ACL, to at least SEE
the contents of $header_to:, but I get an error that debug_print
is unknown there :(

> > /me wonders why nobody told me that.
>
> [looks back at thread]
> That's because you didn't mention where the router was being run (ie. at
> which point in the transaction). Now we know, and you know that you
> can't do this in the RCPT ACL.


I didn't know the router was run as part of the RCPT ACL. I thought that
first all ACLs where run, and then the routers.

> > Now I need to figure out a way to do it anyway.
>
> Put your conditions into the DATA ACL instead, perhaps? We haven't seen
> all of your config (ACLs and routers together) so it's a little tricky
> to clutch at what your system will do.


I thought I could use a condition inside a router: if the condition is
true - I'd route the message the way I want, and if not, it would go to
the next router.

However, if I put the condition in the DATA ACL - then the message is
merely rejected or not. I want to route it :/

Sorry if I sound clueless, but I really really have no ideas left
anymore. I have been trying to route a message based on the presence
of a header for two days now and haven't gotten past the VERY FIRST
thing that I tried: printing the content of $header_to: in the router
definition that I added (to route the message). When printing didn't
work (it always printed an empty string), I tried to add a condition
to see if the contents of the header where there, at least. But it
wasn't. I heard from others that use $header_ in router conditions,
so it should be possible... as you say it is. So, why doesn't it work
for me?

Why does this not work:

spamtest:
  debug_print = "R: spamtest: ${if def:header_To: {yes}{no}}"
  domains = "${if exists{CONFDIR/hubbed_hosts}\
                   {partial-lsearch;CONFDIR/hubbed_hosts}\
              fail}"
  condition = ${if def:header_To: {yes}{no}}
  driver = manualroute
  same_domain_copy_routing = yes
  transport = remote_smtp
  route_data = ${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}}




The header "To:" is present. Why does the condition fail?
Also, the debug_print prints 'no' here.

I understand (now) that the header is not available during the
verification pass from the RCPT ACL - but it works for others when
they use $header-X-Spam-Flag: (for example) in their router!

Utterly confused and frustrated,
Carlo Wood <carlo@???>