[imp] Re: Proper hook to use to modify IMAP/SMTP server info
Jan Schneider
jan at horde.org
Tue Mar 22 16:18:54 PST 2005
Zitat von Eli <eli-list at experthost.com>:
> I am trying to make a virtual webmail interface that can accommodate
> unlimited mail servers by just using MX records from DNS to assume that is
> the IMAP and SMTP server.
>
> I have the PHP code all done for doing this (and had been using this info in
> previous IMP 2.2 installs), however I do not seem to be applying the
> information correctly in IMP. I am currently using the
> "_horde_hook_preauthenticate" hook, however after doing some debugging, it
> seems that this may not be the correct time to modify some settings (or my
> modifications are later being overwritten by info from server.php).
>
> In IMP's server.php file, I use a generic entry:
>
> $servers['imap'] = array(
> 'name' => 'IMAP Server',
> 'server' => 'imap.example.com',
> 'hordeauth' => 'full',
> 'protocol' => 'imap/notls',
> 'port' => 143,
> 'folders' => '',
> 'namespace' => '',
> 'maildomain' => 'example.com',
> 'smtphost' => 'smtp.example.com',
> 'smtpport' => 25,
> 'realm' => '',
> 'preferred' => '',
> 'quota' => false,
> 'admin' => false,
> 'dotfiles' => false,
> 'hierarchies' => array()
> );
>
> I then entirely depend on my code to change those values in IMP so that
> these defaults are never used. The values I am attempting to change on the
> fly are:
>
> 'server' => 'imap.example.com'
> 'port' => 143
> 'maildomain' => 'example.com'
> 'smtphost' => 'smtp.example.com'
> 'smtpport' => 25
>
> Currently my code simply modifies the values in $_SESSION['imp'], however
> that does not seem to be working entirely correctly (I've tested it and it
> *DOES* work, but then when logging in to another server it seems to cause
> all sorts of problems). I have noticed that it seems IMP caches the generic
> server.php info sometimes and attempts to log in to that which obviously
> fails, so users get a login failure message. If I disable the use of hooks
> and hard code the server values in server.php, the user can log in (though
> not entirely for another reason - c-client seems to loop trying to list
> folders on this particular server... but one problem at a time...).
>
> Can someone tell me the proper hook in which I should modify these settings,
> and exactly how I should modify them (just $_SESSION, or something else, or
> a combo)?
If hardcoding the value in servers.php works, why don't you add your
hooks code to servers.php?
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
More information about the imp
mailing list