[imp] Multiple Domains

Thomas O'Brien thomas at creativebusinessystems.com
Wed Oct 20 13:14:10 PDT 2004


Quoting Tony Lay <tonylay at gmail.com>:

> I've been trolling on this list for about a year but I haven't really
> been updating my system...it's quite stable.
>
> I run, let's say, DomainA.
>
> I now have to run DomainB
>
> I have the users all on the same system...but their domain names are
> different...it's two seperate companies.
>
> How do I tweak my servers.php file to accept mail for certian users at
> one domain and certian users at another domain?  Is there a place
> where I can manually add a list to do this?
>
> The mail server is one in the same...so the same IP address.  People
> that hit it from the outside will look the same, but the user id's are
> different so they are distinct.
>
> I haven't seen this plainly put, and I've seen some of the VDomain
> stuff but that doesn't sound like what I'm trying to do here.
>
> Running CVS IMP/HORDE Timestamped  Mar 15  2004 on Freebsd 4.9
>
> Thanks for your help.
>

I host 3 different domains on the same box using the  vinfo hook in
/horde/config/hooks.php. Here's what my vinfo hook looks like:

if (!function_exists('_imp_hook_vinfo')) {
     function _imp_hook_vinfo($type = 'username')
     {
        global $conf, $imp;
        $vdomain = strtolower(eregi_replace('^mail\.|^www\.|^www\.mail\.','',
$_SERVER['HTTP_HOST']));
          if ($type == 'username') {
              return $_SESSION['imp']['user'] . '@' . $vdomain;
         } elseif ($type == "vdomain") {
             return $vdomain;
         } else {
             return new PEAR_Error('invalid type: ' . $type);
         }
     }
}
I also added:
$vdomain =
strtolower(eregi_replace('^mail\.|^www\.|^www\.mail\.','',$_SERVER['HTTP_HOST']));

to the top of servers.php and set

'maildomain' => $vdomain,

in /imp/config/servers.php

When a user hits the login pages thaey are presnted with a username field that
appends the @domain.dom so they do not have to enter their entire
username at domain.dom to log in (using IMP to authenticate)

Lastly, I edited /imp/login.php around line 149 to read

$title = sprintf(_("Welcome to the $vdomain Web Portal"), 
$registry->get('name',
($imp_auth) ? 'horde' : null));

so that the header on the login page reads "Welcome to the Domain.dom Web
Portal"

Thomas




More information about the imp mailing list