I am using java mail api for reading the mails (using imap). I have 2 different mail boxes to read.
Following is configuration used :-
Microsoft Exchange Server 2007
java mail :- tried javamail-1.4 , javamail-1.5
imap.url=imapmail.somedomain.com
imap.port=143
mail.user1=user_id_doesnt_work
mail.pwd1=some_pwd
mail.user2=user_id_works
mail.pwd2=some_pwd
java code :-
private void loginInbox() throws MessagingException{
Folder inbox = null;
Properties mailProps = mailProps = new Properties();
mailProps.put("mail.store.protocol", "imapmail.somedomain.com");
mailProps.put("mail.imap.starttls.enable", "true");
mailProps.put("mail.imap.starttls.required", "true");
Session session = Session.getDefaultInstance(mailProps);
Store store = session.getStore();
store.connect("imapmail.somedomain.com", 143, EMAILUSER, EMAILPWD); //throws exception here
inbox = store.getFolder(INBOX);
inbox.open(Folder.READ_WRITE);
}
I am able to login to both mail boxes through browser ,with both user id and password (url = imapmail.somedomain.com )
> Using JavaMail :-
Using java mail 'mail.user2=user_id_works' , I am able to login to mail.
But When I use java mail 'mail.user1=user_id_doesnt_work' throws exception :
javax.mail.AuthenticationFailedException: AUTHENTICATE failed. at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:723) at javax.mail.Service.connect(Service.java:364)
Could be there any server settings for that particular user which prevents login attempt ? Any thoughts would be appreciated.