[imp] How to use imp_get_vinfo
eculp at encontacto.net
eculp at encontacto.net
Thu May 1 16:06:13 PDT 2003
Quoting Thomas O'Brien <thomas at creativebusinessystems.com>:
| Ed,
|
| Thanks for taking the time to reply.
|
| Quoting eculp at encontacto.net:
| I hope I'm understanding. You probably first want to leave
| 'realm' => '',
|
| Yes. I have done that. Here's what I have:
| $servers['imap'] = array(
| 'name' => 'IMAP Server',
| 'server' => 'fivehole.creativebusinessystems.com',
| 'protocol' => 'imap',
| 'port' => 143,
| 'folders' => 'mail/',
| 'namespace' => '',
| 'maildomain' => '',
| 'smtphost' => 'fivehole.creativebusinessystems.com',
| 'realm' => '',
| 'preferred' => ''
| );
|
| Your imp configuration from the admin menu will need the vinfo hook
| to be enabled, IIRC.
|
| I don't understand this. I thought that the vinfo hook was enabled
| in /horde/imp/config/conf.php in the Custom Hooks section by setting
| $conf['hooks']['vinfo'] = 'imp_get_vinfo';
|
| In horde/hooks.php you will need something like the following based on
| your setup and my understanding of what you want.
|
| I don't see a horde/hooks.php. But again, the function is
| in /horde/imp/config/conf.php. It looks like this
|
| // If this is set to a function name, that function will be used to
| // set the $imp['user'] at login time; See the 'imp_get_vinfo'
| // function below for an example.
| $conf['hooks']['vinfo'] = '';
|
| /* Here is an example imp_get_vinfo function. If $type == 'vdomain',
| * this function returns the HTTP_HOST variable after removing the
| * 'mail.' subdomain.
| *
| * If $type == 'username', this function returns a unique username
| * composed of $imp['user'] + vdomain.
| *
| * ex. $HTTP_HOST = 'mail.mydomain.com', $imp['user'] = 'myname'
| * $vdomain = 'mydomain.com'
| * $username = 'myname_mydomain_com'
| */
| // if (!function_exists('imp_get_vinfo')) {
| // function imp_get_vinfo ($type = 'username') {
| // global $conf, $imp;
| //
| // $vdomain = getenv('HTTP_HOST');
| // $vdomain = preg_replace('|^mail\.|i', '', $vdomain);
| // $vdomain = strtolower($vdomain);
| //
| // if ($type == 'username') {
| // return preg_replace('|\.|', '_', $imp['user'] . '_' .
| $vdomain);
| // } elseif ($type == "vdomain") {
| // return $vdomain;
| // } else {
| // return new PEAR_Error('invalid type: ' . $type);
| // }
| // }
| // }
|
| This is based you your accessing each domain with http://mail.domain.com
| http://mail.domain2.com, http://mail.domain3.com, etc.
|
| Let me clairify exactly what I want to accomplish. I'm trying to configure
| IMP
| for 2 domains:
| creativebusinessystems.com and sk82win.com
|
| I want to access IMP by browsing to either:
| https://www.creativebusinessystems.com/webmail OR
| https://www.sk82win.com/webmail
|
| I want to log in using only the user name rather than username at domain.com.In
|
| Again, I really appreciate your replies.
|
| Thomas
|
Thomas,
Did you not try what I sent? It should work without changes although you
could remove mail in the regex although I like it.:-)
eregi_replace('^mail\.|^www\.|^www\.mail\.',
for
eregi_replace('^www\.',
You can also use preg that I understand is more efficient. I don't know
why :-)
strtolower(preg_replace('|^www\.|i', '', $_SERVER['HTTP_HOST']));
But the original one should have worked. What happened when you tried it?
You did enable it in conf.php, didn't you? If not it will not work. If
your version uses conf.xml you will need to do it using the admin tool.
I hope this helps because I don't know why it didn't work. I must be
missing something obvious. ??
ed
P.S. I'm sending this back to the list, just in case I don't have the
horde versions clear and I know that I don't :-)
--
-------------------------------------------------
More information about the imp
mailing list