Mapi Logon problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Suganthi

    Mapi Logon problem

    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 ImpersonateLogg edOnUser.

    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!
  • Jack Klein

    #2
    Re: Mapi Logon problem

    On 21 Jul 2003 05:08:02 -0700, suganthi.padman abhan@wipro.com
    (Suganthi) wrote in comp.lang.c++:
    [color=blue]
    > 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 ImpersonateLogg edOnUser.
    >
    > 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![/color]

    Ask this in one of the Windows programming groups in the
    news:comp.os.ms-windows.program mer.* family, or one of Microsoft's
    support groups in the news:microsoft. public.vc.* family. Your
    question has nothing to do with the C++ language itself, the only
    topic here. It is entirely about the Windows API.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c++-faq-lite/
    alt.comp.lang.l earn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq

    Comment

    Working...