[imp] Change login data ("user") for full addr ("user at example.com") using IMAP

Chuck Hagenbuch chuck at horde.org
Tue Jun 26 19:30:35 UTC 2007


Quoting Alvaro Uría <fermat at rigel.deusto.es>:

> First of all, I'm very new to Horde-IMP administration, so feel free to
> point me to some documentation (though I've checked some of it, most of
> the official one, and faqs).
>
> What I would like to know is if I can rewrite "imapuser" after
> authenticating to an IMAP server.
>
> I mean, I log in with a "user" and a "password", that can be authenticated,
> and I would like to change that "user" with the full address returned by
> the IMAP server ("user at example.com", or "user at subdomain.example.com", etc.)
>
> I've been looking for vinfo hooks, but I think this is thought for being
> used before any authentication, (and to change $_SESSION["imp"]["user"]).
>
> I've also been looking for IMAP functions on PHP and I haven't seen anyone
> like "imap_get_username" or so (maybe that can't be done).

No, it's not part of the imap protocol unless there's an extension I'm  
not familiar with. How does your imap server "return the full address"?

> The database being checked by IMAP has 4 fields (amongst others):
> 	- adresss (which has "username+ at its_virtual_domain")
> 	- password
> 	- username
> 	- maildir
> 	- ...
>
> ...and I usually authenticate using "username" and "password", but I need
> Horde to know the "address" for not using a default domain when sending
> emails, etc. (BTW, I can also use "address" and "password" for
> authentication, but it's more... handy to use the "username" only. I tell
> you that because it's not a problem once the "imapuser" has been changed
> just after logging in if it's used to authenticate again)

You can consult that database from within preference hooks, or using  
_horde_hook_postauthenticate. Those are both described in  
horde/config/hooks.php.dist and in the wiki.

-chuck


More information about the imp mailing list