[imp] IMP, virtual hosting, genericstable, sendmail and single webmail host

DataServe - Tigchelaar, M.O. martijnt at dataserve.nl
Wed Jan 28 13:08:01 PST 2004


Hello there,

For some time now I have been looking for a solution for my specific
situation

1) I am hosting several domains on my server systems. For all of which I
also handle e-mail traffic.
2) All these domains have their own web server as a virtual host in Apache
3) I have a single user base which is not yet LDAP based (I am using passwd
/ NIS)
4) I wish to offer my customers the functionality of webmail by means of
implementing IMP, BUT, I do NOT want to setup an IMP virtual host for every
domain I am hosting because I think that is just plain old STUPID.
Especially since I already have a way of "virtual hosting" configured for my
mail environment (which is Sendmail).

So, I searched the internet for a couple of hours, browsed through the IMP
mailing list archives once more but I still did not find a way to solve my
problem without implementing LDAP, but that is not what I want to do right
now.

Taken another look at horde/imp/config/conf.php file, I noticed that there
was this example for a custom "imp_set_fullname" function at which I took a
closer look to suddenly realize that this was something I could "abuse"... 

Normally the pw_gecos field in /etc/passwd for instance contains the full
name of a user. But, since I was not using this field for most of the
accounts, I entered the users e-mail address in this place and prepared the
following imp_expand_fromaddress function:

/* Here is an example imp_expand_fromaddress function to set the from
 * address from the GECOS information in the passwd file.
 */
if (!function_exists('imp_expand_fromaddress')) {
    function imp_expand_fromaddress ($imp) {
        $array = posix_getpwnam($imp['user']);
        $gecos_array = explode(',', $array['gecos']);
        return (empty($gecos_array) ? $imp['user'] : $gecos_array[0]);
    }
}

Of course I had to change the line that reads $conf['hooks']['from'] = '' to
read:

$conf['hooks']['from'] = 'imp_expand_fromaddress';

And then I gave it a try to find that this "solution" works for me. At least
for the time being...;-)

So, I am currently testing various other things to see if this change in my
/etc/passwd has some terrible influences elsewhere, but, until now I could
not discover any proof of that.

Perhaps someone likes to comment on this?

Sincerely,

DataServe,
Martijn Olivier Tigchelaar.




More information about the imp mailing list