[horde] Hooks - from_addr & fullname

Lee Evans horde at leeevans.org
Tue Feb 28 04:10:03 PST 2006


I'm hoping somebody will be able to help me. I've setup horde, imp & turba
to provide a webmail interface to our corporate exchange server.

I've succesfully setup turba to provide the Exchange GAL using LDAP queries
back to our domain controllers.

I have a couple of final changes I need to make to ensure that the users get
a smooth experience - automatically configured from addresses, full names
and signatures. Once I've got one of these working I'm pretty confident I
can work out the others, but at the moment I'm struggling.

I have the following in hooks.php and have configured prefs.php to use the

function _prefs_hook_fullname($user = null)
         $ldapServer = '192.168.x.x';
         $ldapPort = '389';
         $binddn = 'ldapuser at company.com';
         $bindpw = 'password';
         $searchBase = 'ou=Company Users,cn=company,cn=com';

         $ds = @ldap_connect($ldapServer, $ldapPort);

         if (is_null($user)) {
             $user = Auth::getAuth();
        if (@ldap_bind($ds, $binddn, $bindpw)) {
         $searchResult = @ldap_list($ds, $searchBase, 'mail=' . $user);

        $information = @ldap_get_entries($ds, $searchResult);
        $name = $information[0]['cn'][0];


        return $name;

Which isn't working. If I substitue the last $name for an arbitrary string
this is correctly assigned to the fullname so the hook itself is being run -
so I guess it must be the LDAP parts that aren't working. I've tried
different combinations of attributes etc to search for, but without any

When I setup turba I was able to use the horde.log file to help me to
diagnose any particular LDAP problems but these hooks don't seem to generate
any log entries which isn't really helping.

Can anyone give me any pointers, anything I can do to debug what's happening
or any obvious mistakes in the above. If you could explain what I can expect
Auth:getAuth() to return or how it knows that to do with @ldap_bind that
would be a good start.

Lee Evans

More information about the horde mailing list