[imp] Sean D & Jason Lohrenz - revisiting imp on plesk?
Sean D.
mojospam at thegeekclub.net
Thu Jul 15 01:20:02 PDT 2004
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();
$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...?
Sean D.
More information about the imp
mailing list