Is it possible to ask an IMAP server for the full email address (refered on mailcore2 as mailbox) of the user?
Some background on why I want to know:
I ask my user to enter their IMAP account details such as username, password, hostname and port. With that information I can successfully connect to the server.
On another part of my app, I need to know the email address associated with that IMAP account. On most servers, the username is the actual email address, but not always. For example, google accepts as username abc.def
when the full email is abc.def@gmail.com
.
You can say: Why the question? Just ask the user for their email as well. Well, I would like not to bloat my interface too much by asking the user to enter yet another string of text, so that is why I'm wondering if there's any way to do this behind the scenes... Thanks.
There was a proposed IMAP extension called POSTADDRESS to do what you want, but so few people added support that the extension died. You might as well ignore it at this point.
Most sensible clients seen to ask for address and password, and try some likely logins based on the email address. If a guess works, fine, if not it's time to ask the user.