This article discusses IMAP login strings:
If you pass a simple username/password to an Exchange Server like this:
pseudo-code:
imapObject.Login("myUsername","myPassword")
an assumption is implicitly made that "myUsername" exists within the current domain of the Exchange Server. If that is not true, you will need to prepend the domain with a forward slash, like this:
imapObject.Login("myDomain/myUsername","myPassword")
If that does not work, check to make sure the user’s mailbox name matches the username. In the "Active Directory Users and Computers" snap-in, this is referred to as the "Alias", and can be seen by navigating to the user, right click -> Properties -> Exchange General. Additionally, if you are familiar with the Lightweight Directory Access Protocol (LDAP), then this property exists on the user as "mailNickname". To specify a particular mailbox, append the mailbox to the username string using a trailing ‘/’ and then the "Alias":
imapObject.Login("myDomain/myUsername/myMailbox","myPassword")
Appending a mailbox entry to the username is also useful for accessing a mailbox that is not the users default mailbox, such as the mailbox of another user to which the person has access too.
imapObject.Login("myDomain/myUsername/joesMailbox","myPassword")
The Active Directory system implements a 2nd type of username, known as the UPN (User Principal Name). It’s the username appended with the FQDN (Fully Qualified Domain Name). In many cases, it ends up being the same as your email address, but it need not be. For example, if your login is "matt" and your domain name is "chilkatsoft", the UPN might be: matt@chilkatsoft.com.
The UPN can be viewed through the Active Directory "Users and Computers" snap-in by navigating to the user, right click -> Properties -> Account, it will be listed here under User logon name. In this dialog, the User Logon Name is actually referring to the combination of 2 text boxes, not just the 1 text box the header is above.
The UPN can be used in the same way as a simple username:
imapObject.Login("matt@chilkatsoft.com","myPassword")
imapObject.Login("matt@chilkatsoft.com/joesMailbox","myPassword")
Obviously, because the domain is specified in the UPN, you don’t need
to prepend the domain name to the UPN.