[imp] get mailserver from login

Edwin Culp eculp@encontacto.net
Fri, 7 Jun 2002 07:51:03 -0700


Quoting ke@helinet.de:

| 
| 
| As we have multiple mailserver with multiple domains and don't want a select 
| button on the login page, we try to do this: the user gives his full 
| mail-address as login (user@domain.de) and we get the "true" login (user)
| from 
| the address and the mailserver (mail.domain.de)
| After reading the mails from Edwin regarding "mail domain", I tried to invoke
| 
| vinfo (with some changes) and changed my servers.php:
| 
| $servers['imap2'] = array(
|     'name' => $vdomain,
|     'server' => 'mail.'.$vdomain,
|     'protocol' => 'imap',
|     'port' => 143,
|     'folders' => '',
|     'namespace' => '',
|     'maildomain' => $vdomain,
|     'smtphost' => 'localhost',
|     'realm' => '',
|     'preferred' => ''
| );
| 
| The problems seems to be to get the $vdomain in servers.php. I suggested, 
| something like
| ($user,$vdomain)= split ("\@",$imp['user']);
| would do the job, but this is wrong. Does anyone know, how to get the domain 
| from the login-page in servers.php?

Kerstin,

I do it this way.
  
$vdomain = strtolower(preg_replace('|^mail\.|i', '', $_SERVER['HTTP_HOST']));

$servers['_prompt'] = array(
    'name' => 'Choose a mail server:'
);

$servers['imap'] = array(
    'name' => $vdomain,
    'server' => $vdomain,
    'protocol' => 'imap',
    'port' => 143,
    'folders' => 'INBOX.',
    'namespace' => '',
    'maildomain' => $vdomain,
    'smtphost' => $vdomain,
    'realm' => '',
    'preferred' => $vdomain
);

It works, but I am definately open to making it better so any suggestions
will be appreciated.

I hope that this gets you started.

ed


-------------------------------------------------------------
 http://insourcery.com - Mergence of Business and Technology  
          a "Griffin Plaza Partners, LLC" Company