Re: [exim] LDAP and secondary MX

Top Page
Delete this message
Reply to this message
Author: Kjetil Torgrim Homme
Date:  
To: Stian Jordet
CC: exim-users
Subject: Re: [exim] LDAP and secondary MX
On Thu, 2005-08-11 at 23:00 +0200, Stian Jordet wrote:
> and I want exim to first check if mailHost==$hostname. If it matches, it
> should accept the mail and deliver it. If it does not match, it should
> accept it, and send it to the host in mailHost.
>
> Is this possible? Is there a variable containing the hostname, so I can
> test against that? And can I use two conditions in an accept router?
> (One to find the username of the receipent, and one to test if hostname
> == mailHost). I could really, really need some help with that
> condition...


here's two of our routers, the first only sets address_data. call it
early. (as you can see, we have many attributes which are used in other
rules.)

set_address_data:
  driver = redirect
  local_part_suffix = +*
  local_part_suffix_optional
  address_data = ${lookup ldap {ldap:///cn=mail-targets,dc=uio,dc=no?\
                target,targetType,mailPause,uid,spoolInfo,\
                spamAction,spamLevel,defaultMailAddress,\
                forwardDestination,mailHost,tripnote,\
                tripnoteActive?sub?\
                (mail=${quote_ldap:$local_part@$domain})}\
              {$value}}}
  # ph10's recommended way of writing a non-routing router: "Use a
  # redirect router that redirects to the same address; set the
  # redirect_router option to point to the next router."
  # If we only need to set "address_data", we can cheat and set "data"
  # to the empty string.  The router will decline, but that's fine.
  data = 


deliver_elsewhere:
  driver = manualroute
  verify = false
  condition = ${if and {{def:address_data}\
                        {eq {${extract{mailHost}{$address_data}}}{$primary_host_name}}}\
                   {false}{true}}
  transport = remote_smtp
  route_data = ${extract{mailHost}{$address_data}}


I've edited the routers a little, so errors may have snuck in. it
should give you an idea, anyway.

--
Kjetil T.