Mapi Logon problem

Discussion in 'C++' started by Suganthi, Jul 21, 2003.

  1. Suganthi

    Suganthi Guest

    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!
    Suganthi, Jul 21, 2003
    #1
    1. Advertising

  2. Suganthi

    Jack Klein Guest

    On 21 Jul 2003 05:08:02 -0700,
    (Suganthi) wrote in comp.lang.c++:

    > 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!


    Ask this in one of the Windows programming groups in the
    news:comp.os.ms-windows.programmer.* 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.learn.c-c++ ftp://snurse-l.org/pub/acllc-c /faq
    Jack Klein, Jul 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pat Sinnott
    Replies:
    0
    Views:
    1,248
    Pat Sinnott
    Jul 7, 2003
  2. Kjell Kristiansson
    Replies:
    0
    Views:
    282
    Kjell Kristiansson
    Nov 30, 2005
  3. mahadewa

    ASP.NET Security problem trying to access MAPI

    mahadewa, Nov 16, 2006, in forum: ASP .Net Security
    Replies:
    0
    Views:
    256
    mahadewa
    Nov 16, 2006
  4. Adam Kinney

    MAPI.Profile Logon with ASP

    Adam Kinney, Feb 10, 2004, in forum: ASP General
    Replies:
    2
    Views:
    198
    Lee Derbyshire
    Feb 11, 2004
  5. Jeff Miller

    MAPI Logon

    Jeff Miller, Mar 26, 2008, in forum: Ruby
    Replies:
    3
    Views:
    328
    Jeff Miller
    Mar 27, 2008
Loading...

Share This Page