[imp] Best way to achive email hosting for several domains

Andrew Morgan morgan at orst.edu
Thu Mar 20 16:11:54 UTC 2008


On Thu, 20 Mar 2008, Roberto Nunnari wrote:

> Hi Jan.
>
> Could you please point me to a howto or introduction to
> vinfo hook?
>
> Thank you.
> Robi.
>
>
> Jan Schneider wrote:
>> Zitat von Roberto Nunnari <robi at nunnisoft.ch>:
>>
>>> Every mailbox as a local unix account, ie:
>>> info at adomain.com --> a1
>>> steve at adomain.com --> a2
>>> info at anotherdomain.com --> b1
>>> joe at anotherdomain.com --> b2
>>> etc..
>>>
>>> Now, everything works fine, but I'm a bit concerned with the
>>> webmail login.. I'd like info at adomain.com to login with a
>>> username equal to the email, but at present the authentication in
>>> horde is handled by imp, I'm not sure how to proceed with that..
>>
>> You could use the vinfo hook to convert between both user name styles.
>>
>> Jan.

Here is an example vinfo hook that we use to force all usernames to 
lowercase:

if (!function_exists('_imp_hook_vinfo')) {
         function _imp_hook_vinfo($type = 'username') {
                 if ($type == 'username') {
                         return preg_replace('/\s/', '', strtolower($_SESSION['imp']['user']));
                 } elseif ($type == 'vdomain') {
                         return '';
                 } else {
                         return PEAR::raiseError('invalid type: ' . $type);
                 }
         }
}


You could replace the code inside "if ($type == 'username') { ... }" with 
code to convert from "info at adomain.com" to "a1".  Perhaps you have this 
mapping stored in LDAP, MySQL, or a flat file?  The specifics would be up 
to you.

 	Andy


More information about the imp mailing list