[imp] Sean D & Jason Lohrenz - revisiting imp on plesk?

Jan Schneider jan at horde.org
Fri Jul 16 02:17:49 PDT 2004


Zitat von "Sean D." <mojospam at thegeekclub.net>:

> brandon at xcodes.net wrote:
>
>> Hi Sean,
>>
>> Sorry to email you direct.  I have just joined this mailing list just a
>> moment ago and I'm interested in the codes to grab the domain name from
>> the url the user put in the browser (i.e. webmail.SOMEDOMAIN.com) and
>> then set the "realm" and "maildomain" to somedomain.com.
>>
>> Do you mind to send me a copy? Thanks!
>>
>> ./Brandon
>>
>
> sure.. i dont mind you emailing me direct put i'm posting this back 
> to the list
> so anyone else who wants it can have it.
>
> i have changed it from the way they do it a little bit (mostly in the other
> files) but this is the chunk of code they use in 
> imp/config/sources.php to set
> the realm and maildomain.
>
> // get hostname from http URL (patch for PSA) mojo wuz here
> $headers = getallheaders();

Is this variable actually used anywhere later?

> $patterns[0] = "/^webmail\./";
> $patterns[1] = "/^www\./";
> $patterns[2] = "/^mail\./";
> $vdomain = getenv('HTTP_HOST');
> $vdomain = preg_replace($patterns, '', $vdomain);
> $vdomain = strtolower($vdomain);
>
> $servers['imap'] = array(
>      'name' => 'IMAP Server',
>      'server' => 'localhost',
>      'protocol' => 'imap/notls',
>      'port' => 143,
>      'folders' => 'INBOX.',
>      'namespace' => '',
>      'maildomain' => $vdomain,
>      'smtphost' => 'localhost',
>      'realm' => $vdomain,
>      'preferred' => ''
> );
>
> although you could probably just as easily use the 
> $_SERVER['SERVER_NAME'] bit
> of code to set the domain.  maybe Jan knows which way is more 
> efficient coding...?

$_SERVER['HTTP_HOST'] actually, but looks good otherwise.

Jan.

--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting.php


More information about the imp mailing list