Hi,
I have a specific problem while using MAPI for sending the emails from
my application.
My requirement is as follows.
My application will be running either as a service or a process in a
windows 2000/NT server.
For a given user (who is Windows NT user) in the same Windows 2000
server, I want to get the default MAPI profile and send mails using
that profile details. The NT user details obtained as an user input
can be the locally logged on user or some other user in the same
server.
Is it possible to get the same? If yes, how will I do it.
Currently i have tried the following:
1. With the input information (ie) user name, password and domain,I am
doing a LogonUser with valid credentials to get the access to
ExchangeServer. I obtain the handle to the user session through this
call.
2. With the obtained handle, i load the user profile using
LoadUserProfile and then ImpersonateLoggedOnUser.
3. Then with the obtained user profile i perform a MAPILogonEx to
obtain the MAPI session handle. The MAPILogonEx call succeeds, but the
mapi session handle always remains NULL. Since the mapi session handle
is not valid, SendEmail is failing.
What could be the reason for this failure?
Also it would be very helpful if i can get the sequence of operations
to be performed to achieve my requirement.
Thanks!