[exim] testing for availability of a host in RCPT ACL

Top Page
Delete this message
Reply to this message
Author: Chris Lightfoot
Date:  
To: exim-users
Subject: [exim] testing for availability of a host in RCPT ACL
[ Apologies if this is a duplicate -- I wasn't on the list
when I posted it earlier, and I think the first copy has
been swallowed.... ]

I want to write a recipient ACL in which a callout is made
to test the deliverability of the recipient address and,

(a) if the recipient is definitely deliverable, the ACL
    returns `defer';


(b) if the recipient is definitely undeliverable, the ACL
    returns `deny'; and


(c) otherwise it returns `accept'.

(The application is for a secondary MX host where it is
not practical to apply the same content filtering etc.
conditions as on the primary; therefore, in the most
common case where the primary is up -- and therefore the
recipient test succeeds -- I want to return 451; if the
address would in any case be undeliverable, 550; and
otherwise accept the mail.)

So, I tried something like this:

    defer   domains = +relay_domains
            verify = recipient/callout,nocache
            message = Primary MX for $domain is up, please try that


    deny    domains = +relay_domains
            !verify = recipient/callout
            message = Recipient $local_part@$domain not deliverable


    accept  domains = +relay_to_domains


... and in the first two cases it works. Unfortunately, in
case (c), where the remote host is down, the defer
condition is failed and returns ``451 Could not complete
recipient verify callout''. My reading of the spec
(§39.32) is that this is the design behaviour: verify =
recipient/callout conditions are special in that a defer
result will immediately cause the whole ACL to defer.

The defer_ok modifier doesn't help in this case as it
causes the condition to return true, which would mean that
the `defer' stanza fires when the remote host is *down*,
which is exactly wrong.

What I'd like in this case is for the verify = recpient
condition to result in a failure with an appropriate value
in $recipient_verify_failure or somewhere else that I can
test it. Is there a way to do this?

(I actually have an interim solution to this which uses
perl to perform the callout, but that's horrid -- one
implementation of SMTP per program is enough....)

--
``The efficiency of the rocket launcher team was also very impaired.''
(commentary on film of British troops given LSD as part of a 1960s
chemical warfare experiment)