dov.amir
dov.amir

Reputation: 11637

read email from an email acount on an exchange server through java mail api

I am trying to access an exchange server to read emails from a specific acount using JAVA mail.

I can access gmail with something like

Properties properties = System.getProperties();
Session session = Session.getDefaultInstance(properties);
store = session.getStore("pop3");
store.connect(host, username, password);

but since I am using exchange I dont have pop3, I only have server name : mysrv ,domain name: MYDOMIAN and a mailbox : [email protected].

So what is the correct way to connect to exchange?

Upvotes: 0

Views: 13796

Answers (2)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66255

IMAP4 won't give you contacts/appointments/tasks/etc. You can use EWS, Outlook Object Model (assuming you have Outlook installed and a profile configured to talk to a particular mailbox) or Redemption (I am its author) and its RDOSession object(RDOSession.LogonExchangeMailbox etc.)

Upvotes: 0

Kamran Ali
Kamran Ali

Reputation: 5954

you may try

Properties properties = System.getProperties();
Session session = Session.getDefaultInstance(properties);
store = session.getStore("imap");
store.connect(host, username, password);

Upvotes: 2

Related Questions