473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 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!
Jul 19 '05 #1
1 4920
On 21 Jul 2003 05:08:02 -0700, su******************@wipro.com
(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
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kurt | last post by:
Hi I am using CDO 1.21 from C# in order to iterate through the entries in a users outlook address book (as OOM was too slow). Basically I take the Name field from each "message" and insert it into...
0
by: Sandy Beach | last post by:
Hi, I have an app, written in c#, that checks an email inbox (using cdo/mapi) and does some processing. I've written a function "WriteToLogFile (string text, bool onConsole)" that checks...
1
by: Jay McGrath | last post by:
Help - trying to send a simple text email with with as little user intervention. I am trying to create a button in my Access application that will automatically send a simple text email. It...
0
by: DC Fan | last post by:
I am wirting an application in Access 2002 (XP) that needs to send email. Since I hate the dialog boxes you get from all the Outlook warning messages, I am trying to use the MAPI object. On *SOME*...
7
by: Ottar | last post by:
I've made a program sorting incomming mail in public folder. The function runs every minute by using the form.timer event. In Access XP it runs for weeks, no problem. Access 2003 runs the same...
2
by: Gerry | last post by:
I am writing a program in C# which accesses data from Exchange. Code snippets have been copied from a VB-program. The VB-program does the following: 'create session and logon objSession =...
0
by: Grahame | last post by:
Hi, I have an app, written in c#, that checks an email inbox (using cdo/mapi) and does some processing. I've written a function "WriteToLogFile (string text, bool onConsole)" that checks...
0
by: Kevin Quigley | last post by:
Hi, I have a web page that will send emails to various addresses, I've tried using the SmtpMail class but no matter what I try it will not work. I have an asp page that does actually work...
0
by: PhilHip | last post by:
I've written a Windows service in VB.Net that accesses the global address list to obtain all the entries to store them in a local database. The GAL is accessed using the MS Exchange profile on the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.