• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 691
  • Last Modified:

simple MAPI help

First, I am not sure if I want to use MAPI
but, I do know what I need to do.

I am working on a pretty basic email client.
It will support attachments (send & recieve)
and html send and recieve
that's really about it, I don't need an address book or anything else fancy than that.

I am stuck because it appears there is problem using MAPI becuase it does not work with outlook express.

I am really trying to get away from using Outlook.

I need your advice and recommendations on which way to procede.

I am not a very knowledgeable C++ programmer.

so trying to decode MIME and parse the emails could be time consuming.

basically, I am trying to replace ACT! email because it is woefully inadequate ( no html, bad attachment supt).  I don't want any of it's same shortcommings, so I want a quick and reliable method of going about this, that will work on the 100+ computers at our company ...all in the same way...

I would really like it to work without outlook or outlook express, or at least, be version independent.

I read through pretty much all your posts about MAPI, and it does say that Simple MAPI can communicate with outlook express, but I downloaded the sample from MS website, and it only works for me with outlook, not outlook express.

Thanks so much,


2 Solutions
>> it only works for me with outlook, not outlook express.

What exactly happens when you try to use it with outlook express?

When you try to use it with Outlook Express, do you have Outlook Express setup as your default email program?
bebonhamAuthor Commented:
It gives me errors...

Microsoft Outlook pops up a message and says

"Either there is no default mail client or the current mail client cannot fulfill the messaging request.  Please run Microsoft Outlook and set it as the default mail client."

this msg box has a title of "Microsoft Outlook" so that is why I say outlook is poping it up, not the ms. sample program.

(also that msg box text is not in the m.s. .h and .cpp files)

so...it seems Outlook may be doing something...I don't know...

then if I try and create a message or read a message from my inbox, it crashes.


Before running the program, first conduct the following test.
Open a program like MS Word or MS Excel.
Create or open a document.
Try to mail the document FROM THE APPLICATION.
This can be done by clicking on the main menu FILE->[Send-To]->[Mail-Recipient]

If Outlook Express starts up, then you do have Outlook Express setup right.

If Outlook Express does NOT start up, then you don't have Outlook Express setup as your email program, and that is where you're problem is at.  It's not the code that is the problem.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

If the above test proves Outlook Express is setup right, can you please post your MAPI code?
bebonhamAuthor Commented:
I am only using the compiled EXE that I downloaded from MS website.

I am having trouble getting the actuall cpp and .h files to compile I have the error

"c:\cpptests\st\swap.cpp(1286) : fatal error C1010: unexpected end of file while looking for precompiled header directive"

this is happening in a mfc dialog project...
I have added swap.cpp and swap.h to the project and then I added this one function to my dialog:

void CStDlg::OnOK()
lpCApp pCApp = NULL;     // Global application object

     HRESULT hRes = S_OK;
     int          lpMenuChoice;   // Selection made by the user
     int          nNotDone = 0;     // Determined when to quit control loop.
     pCApp = new ( CApp );    
//     CDialog::OnOK();

I will post the microsoft code if you like, but you can also download it from there website here:




bebonhamAuthor Commented:
also the test w/ excel spreadsheet shows outlook express as the default client
bebonhamAuthor Commented:
now I only have these errors preventing compilation

swap.obj : error LNK2001: unresolved external symbol _MAPIUninitialize@0
swap.obj : error LNK2001: unresolved external symbol _MAPIAllocateBuffer@8
swap.obj : error LNK2001: unresolved external symbol _MAPIInitialize@4
swap.obj : error LNK2001: unresolved external symbol _MAPIFreeBuffer@4
Debug/st.exe : fatal error LNK1120: 4 unresolved externals
Do you have the most current SDK loaded on your computer?
To me, it looks like you don't have the most current SDK loaded.
You can update your SDK via the following link:
bebonhamAuthor Commented:
okay I resolved those problems I was having, and it is now compileing, but still have same problem with the outlook message popping up as before I will d/l sdk it looks like it will take a while at ~=300 meg

I will keep playing with this though.

Thanks, I will get back as soon as d/l completes.

bebonhamAuthor Commented:
Hi Axter,

well, I changed over the MS sample from being printf to afxmessagebox for my debugging, and for some reason it seems to work so far (only tested reading message subjects from outlook express in box)

it also could have been the SDK's that fixed it, because I didn't get it working untill after I d/l them.

I will keep this q. open for one more day (incase I run in to problems with the MAPI) but I will award points for your help tomorow.

as always thanks for your help

>>as always thanks for your help

Any time.
If You want to work only with Outlook (not Express), I have a one trick how to do this. This is a change of registry settings...

If you are interesting, please ask me by e-mail maito:igolubev@entopia.com.
Posting my previous comments as answer
bebonhamAuthor Commented:
wow,  sorry I left this open so long!!!
No problem.  I forgot about it myself, until Ilia posted a comment.
Proposed answer rejected; this SHOULD close the question.

CS Moderator

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now