Re: [exim] how to detect if address aliased?

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Tony Finch
Date:  
À: Magnus Holmgren
CC: exim-users, Giuliano Gavazzi
Sujet: Re: [exim] how to detect if address aliased?
On Sat, 10 Dec 2005, Magnus Holmgren wrote:
> Giuliano Gavazzi skrev:


> > In short, how do I detect that a redirect router has successfully
> > redirected an address?
>
> Suggestion: Set address_data in the redirect routers (make sure that you
> have preconditions that fail for addresses not handled by the routers),


This is what I do. We have virtual domains in the form of aliases files.
Some domains have "escape routes" for special case addresses (such as
ticketing systems) which are only valid internally to our mail hub and by
arrangement with the target system. E.g. there might be an escape route in
the botolph.cam.ac.uk domain for rt.botolph.cam.ac.uk.

Note that the validity of escape routes is independent of where the
address originally came from, so it is best to implement this check in the
routers, not the ACLs. For example, we don't check recipient address
validity in our smarthost and submission ACLs, so implementing the check
in the routers means that messages which arrive from internal users are
still bounced when appropriate.

# ...

# Escape routes work in almost exactly the same way [as manual routes], except that the
# current address must be annotated to enable this router. The
# annotation is added by the virtual_aliases router, which means that
# escape routes only work as an extension to managed mail domains.

escape_routes:
  driver                = manualroute
  domains               = +escape_routes
  condition             = ${extract {escape}{$address_data} }
  route_data            = $domain_data
  host_find_failed      = defer
  same_domain_copy_routing
  transport             = smtp


escape_fail:
  driver                = redirect
  domains               = +escape_routes
  data                  = :fail: Invalid domain part in email address
  allow_fail


# ...

# We note in $address_data that escape routes are enabled (see above).

virtual_aliases:
  driver                = redirect
  domains               = +virtual_domains
  address_data          = escape=yes
  data                  = ${lookup {$local_part} \
                            cdb {DOMAINS/db/${domain}.cdb} }
  forbid_blackhole
  forbid_file
  forbid_include
  forbid_pipe
  check_ancestor
  retry_use_local_part


# ...

> If you use address_data for other purposes it becomes more complicated,
> of course.


If you add keyword/value pairs to address_data then you can use ${extract
to pull out the various parts. If you are careful you can then use if for
multiple purposes.

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}