473,698 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!
Jul 19 '05 #1
1 4943
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 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!


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
Jul 19 '05 #2

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

Similar topics

4
7189
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 a ListBox. I shall paste my code at the end, and describe my problem first If I call my MAPI.Sessions Logoff method when I have finished using it, then this method takes between 1 and 5 minutes to execute, but after that everything is fine If...
0
1321
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 whether the logfile exists (creates it if not), appends the text to the file, closes the file and displays it on the console, if required. It uses StreamWriter to accomplish this.
1
5340
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 works except that I have two warning nuisances: 1) Program is trying to access email Addresses you have stored in Outlook. Allow access for ... 2) A program is trying to automatically send email on your behalf ... Heck, I am only trying to a send...
0
3464
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* PC's the code runs fine, but on others, the code can execute the logon portion of the code just fine, but when it tries to create a message, I get the following error codes: -2147221219, which when I look it up is MAPI_E_FAILONEPROVIDER. I can...
7
4194
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 code for 6 hours and stops. I've found the problem to be the Set MySession = CreateObject("MAPI.Session")
2
8569
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 = CreateObject("MAPI.Session") After this, everyhing works fine.
0
1126
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 whether the logfile exists (creates it if not), appends the text to the file, closes the file and displays it on the console, if required. It uses StreamWriter to accomplish this.
0
1430
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 using mapi.session... <% Const cStrServer = "sciehex01" Const cStrMailbox = "weeklyreportuser"
0
2183
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 current machine. The service then creates a new MAPI session and then attempts to log on to the session using the current MS Exchange profile on the machine. Here is the section of code that is erroring: Dim oSession As MAPI.Session...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9026
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.