Ben Wheare wrote:
> Hi,
> 
> I'm trying to figure out a way how I can do the following:
> 
> Email is delivered to [EMAIL PROTECTED] (the form [EMAIL PROTECTED])
> 
> I want Exim to receive this mail, do an LDAP lookup for the record that 
> matches firstname=joe AND surname=bloggs and return the field 
> userid=jbloggs, so that I can deliver mail to the maildir 
> /maildirs/{userid}/.
> 
> I've got it delivering mail to maildirs, and creating the maildirs on 
> the fly, using a a file and lsearch. What I want to do now is extend 
> that to LDAP and firstname.surname expansion.
> 
> Anyone have any pointers?
> 
> Thanks,
> 
> Ben
> 

Yes, you can do it, using the local_part_prefix operator.
Whether it's wise to do so or not is entirely up to you...

ldapfirstlast:
   driver = redirect
   local_part_suffix = .*
   data = ${lookup ldap { \
      user=LDAPU \
      pass=LDAPP \
      LDAPS/LDAP_BASE?\ 
uid?sub?(&(givenName=${quote_ldap:$local_part})(sn=${quote_ldap:${substr_1:$local_part_suffix}}))}\
                {$value} fail}


Here, LDAPU, LDAPP, specify the binding user and password,
LDAPS is the URI ldaps://ldap_server and LDAP_BASE is the base of the search, 
so 
would be of the form ou=accounts,dc=whatever.

-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
             University of Leicester, Leicester, LE1 7RH, UK
E-mail :    [EMAIL PROTECTED]
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to