[horde] User Presets

Ralf Lang lang at b1-systems.de
Mon Apr 2 16:59:28 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> because our email setup is a little bit, legacy, every mailbox has
> not an email adress but a name like "Username0001" as login name, 
> and, because horde authentiocates itself against the imap server
> the usernames for horde are also "Username0001". this leads to the
> problem that the default adress in the from field is 
> "Username0001@", which leads to the problem that the outgoing
> email server wont let me send any email before i change my
> setting.
> 
> So my question would be if there is any posibility to build
> something like a hook or so, that, if the user hsn't changed the
> defaut settings, makes an sql query which gives back the correct
> email adress?

Yes, it's possible. You need a preference hook.

Simple Example horde/config/hooks.php

class Horde_Hooks
{
    public function prefs_init($pref, $value, $username, $scope_ob)
    {
        if (is_null($username)) {
              return $value;
        }

        switch ($pref) {
          case 'identities':

            if ($value){
                $identities = unserialize($value);
            } else {
                $identities = array();
            }

            $identities[0]['id']            = 'Standard';
            $identities[0]['from_addr']     = $username . '@mydomain.com';
            $identities[0]['location']      = 'Germany';

          return serialize($identities);

        }
    }

You could also build a default signature or query an ldap or mysql
source for the user's full name.






- -- 
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail: lang at b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk952vAACgkQCs1dsHJ/X7AwWwCfU7wnOS1pvXn8q+KAOW735c5M
6uoAnj1SckigQTLfxcRIjrs0YG5JuU3f
=ivto
-----END PGP SIGNATURE-----


More information about the horde mailing list