Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use Javamail for accessing additional mailboxes -IMAP, Exchange 2010

953262Aug 1 2012 — edited Aug 6 2012
hi,

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 (user1@domain.com)
pwd: xxxx
shared mailbox: shared_MB@domain.com

Properties:

mail.imaps.socketFactory.port = 993
mail.imaps.starttls.enable = true
mail.imaps.socketFactory.class = javax.net.ssl.SSLSocketFactory
mail.imaps.socketFactory.fallback = false
username = user1@domain.com
password = xxxx


I´ve managed to get access to the user1 - mailbox:

Session session = Session.getInstance(properties, new ExchangeAuthenticator(username, password));
session.setDebug(true);
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:
username=user1@domain.com/shared_MB (user@domain/additional_MB)


--> 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.
A0 CAPABILITY
* 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, user=user1@domain.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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 3 2012
Added on Aug 1 2012
6 comments
8,557 views