Hi everyone,
I'm trying to write a Java class that receive e-mail from Microsoft
Exchange server.
I can get to the e-mails manually using Outlook 2000 without any problems.
When I start Outlook, I have to fill in user name, domain, and password.
It seems that the easiest way to do this programmatically would be through
CDO/COM... I installed Visual J++ and tried some
examples from Microsoft... Can't login to the Exchange server through my
class... I also looked at their examples in VC++ and
in VB.
There seem to be two ways to login:
1) By supplying the profile name:
session.Logon( new Variant("MS Exchange Settings"), nullParam, nullParam,
nullParam,nullParam, nullParam,nullParam);
This method call does not cause an exception, but subsequent attempt to
get the inbox does:
inBox = (Folder) session.getInbox().getDispatch();
com.ms.com.ComFailException: An unexpected error has occurred.
MAPI was unable to load the information service EMSMDB.DLL. Be sure the
service
is correctly installed and configured. [MAPI 1.0 - [MAPI_E_NOT_FOUND
(8004010F)]]
at cdo/Session.getInbox (Session.java)
at Sample1.main (Sample1.java:45)
I understand that EMDMDB.DLL is an old 16-bit library (I'm on NT 4.0 SP 6,
by the way). I saw some mentions of it in
newsgroups and on MSDN. Nobody explains why it happens, but the resolution
is to use the profileInfo parameter. Fine.
2) By supplying the profileInfo parameter:
session.Logon( nullParam, nullParam, nullParam, nullParam, nullParam,
nullParam, new Variant(server + '\n' + mailbox) );
This time, logon fails right away:
com.ms.com.ComFailException: [Collaboration Data Objects -
[MAPI_E_LOGON_FAILED
(80040111)]]
at cdo/Session.Logon (Session.java)
at Sample1.main (Sample1.java:19)
Microsoft KB gives several reasons for this to happen. None of them seem
to apply to my case.
I don't know what to do about these cryptic errors. I tried playing with
other parameters -- nothing seems to work.
And there does not seem to be a way to supply my user name (which is
different from the mailbox name) and domain (which is
different from the exchange server name).
Can anyone help me, please?
Thx,
Sergei