I want to access a shared mailbox (NOT FOLDER) via Javamail API (1.4.5) using IMAP(s) with plain logon. The mailserver is a Exchange Server 2010.
User: user1 (email@example.com)
shared mailbox: shared_MB@domain.com
mail.imaps.socketFactory.port = 993
mail.imaps.starttls.enable = true
mail.imaps.socketFactory.class = javax.net.ssl.SSLSocketFactory
mail.imaps.socketFactory.fallback = false
username = firstname.lastname@example.org
password = xxxx
I´ve managed to get access to the user1 - mailbox:
Session session = Session.getInstance(properties, new ExchangeAuthenticator(username, password));
Store store = session.getStore("imaps");
store.connect(imapHost, username, password);
--> this works just fine! But now i want to access the additional mailbox by changing the login-String:
--> unfortunately I´m getting an "NO AUTHENTICATE" message:
DEBUG: setDebug: JavaMail version 1.4.5
DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc]
DEBUG: mail.imap.fetchsize: 16384
DEBUG: mail.imap.statuscachetimeout: 1000
DEBUG: mail.imap.appendbuffersize: -1
DEBUG: mail.imap.minidletime: 10
DEBUG: trying to connect to host "host.domain.com", port 993, isSSL true
* OK The Microsoft Exchange IMAP4 service is ready.
* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+
A0 OK CAPABILITY completed.
DEBUG IMAP: AUTH: NTLM
DEBUG IMAP: AUTH: GSSAPI
DEBUG IMAP: AUTH: PLAIN
DEBUG: protocolConnect login, host=host.domain.com, email@example.com/shared_MB, password=<non-null>
DEBUG IMAP: AUTHENTICATE PLAIN command trace suppressed
DEBUG IMAP: AUTHENTICATE PLAIN command result: A1 NO AUTHENTICATE failed.
javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
I was able to get access with Thunderbird and also with the Exchange OWA-Client, so I think there is something missing in my code...
or is it just impossible to get access to a different mailbox using javamail and plain-auth?
Thank you in advance.
Silly as I am, when I run into an error I can't explain I just copy/paste it into Google. Just like that, what a sneaky devil I am! Of course some careful examination of the logging is required before you know what part may be interesting. In this case "A1 NO AUTHENTICATE failed" tickles my fancy. Now normally I would put "java" in front of it, but in this case it seems like an error message that Exchange itself would return, so I just keep it general.
And what do you know, plenty of search results come up. This one in particular looks interesting:
I suppose it's possible that Exchange 2010 has the same bug as Exchange 2007 with plain authentication.
Also see this page for more notes about using JavaMail with Exchange:
Thanks for your response.
I´ve tried that before with the same result:
DEBUG IMAP: AUTHENTICATE NTLM command result: A1 NO AUTHENTICATE failed.
btw. Plain-Auth is working for usernames like: domain/user1 or user1@domain.
Unfortunatly a "fully qualified" string like user1@domain/mailbox isnt...
And what really "tickles me fancy" is that the guys from Thunderbird somehow managed to get access to those mailboxes.
It seems I only have three options to solve that problem:
1. using some .net - stuff
2. figuring out how to handle webservices implemented in Exchange-Server 2010
3. asking my Mailbox-Operator again and again to give me the password for a direct-access to the mailbox (he won´t)
but thanks again for your help.
Try turning on protocol logging for Thunderbird as described here:
If it shows you how Thunderbird is authenticating, you should be
able to replicate that with JavaMail.
okay... The answer was kind of "simple":
Deactivate every AUTH - Method which are published by the Exchange Server and you are able to logon to shared mailboxes like this:
firstname.lastname@example.org/sharedMB .... Damn this was such a pain!
In my case I´ve had to deny following AUTH-Methods
Edited by: 950259 on 06.08.2012 06:56