MAPISendMessage problem, multiple workstations.

MAPISendMessage problem, multiple workstations.

Post by U2hhdW4gV2 » Wed, 09 Feb 2005 10:29:04

I am using a mapi exaple from the MSDN KB, this works well on the laptop that
I develop from, but when I build and deploy to another computer the code no
longer works.

The error code received from MAPiSendMessage is "2", general email error,
the GetLastError is a 0x7E, module not found. This leads me to believe these
systems are missing necessary support, but what?

Each test system has one of either Outlook 2003, Outlook Express or MSN
Mail. I am unsure if there are libraries I need to install or what, as far as
I know there is not redistributable package for Simple MAPI. All installs are
full installs, not typical installs.

I have verified the contents of win.ini, the Explorer "Send to" mail
recipient link works. I have tried packaging a mapistub.dll from my dev
workstation, verified mapi32.dll one all machines and I have tried installing

Nothing helps. My intent was to launch the default mail editor/application
with a 'template' email generated programmatically. I am doing this from C#,
again it works fine on the development workstation (and of 5 dev workstations
here, mine is the only one which it works). I have tried writing 3 versions
of the mapi code, and I am currently using a Managed C++ variant because it's
the most reliable version IMO. I can provide this code if it would help.

If there is another way to accomplish my task, let me know. Currently I am
using MAPISendMail with MAPI_DIALOG and MAPI_LOGON_UI flags. I specify a
subject, body and then leave all other params null.

TIA -- Shaun Wilson

MAPISendMessage problem, multiple workstations.

Post by Dan Mitche » Sat, 12 Feb 2005 08:45:28

=?Utf-8?B?U2hhdW4gV2lsc29u?= < XXXX@XXXXX.COM >

That's correct, you get Simple MAPI from whichever mail client is on
the system.

That would probably help -- you're using LoadLibrary(), GetProcAddress
(), etc, as usual, right?

You're definitely on the right path, for what it's worth.

What happens if you try the sample code at (for instance) , if
you want to go the .net route; Q315367 is a C# sample. Oh, good grief.
Now I check, they aren't any more, I guess MS took them away. Sigh. What
the heck are they thinking there? Maybe just try the first one, then.

-- dan


MAPISendMessage problem, multiple workstations.

Post by U2hhdW4gV2 » Wed, 23 Feb 2005 07:21:02

I am now using a library from Teknosyne, basically the same code I had before
except it's all done in C# using Marshal calls and also has a handy string
table for resolving win32 error codes.

This seems to be what everyone says, but on all systems which have at least
one of these Microsoft applications installed I still get a 'module not
found' error (GetLastError result). One thing that is different on my machine
vs. other machines is the existence of the MSN Mail Connector for Outlook.

An employee here suggested maybe that is why Simple MAPI works on my
machine, but no others. But that doesn't make sense given everyone tells me
that "you only need outlook or outlook express installed".

Correct, it works great on the development machine. Doesn't work on the 6
other machines I've tested it on. Even installed visualstudio onto one
machine to see if that made any difference, made none.

This sample runs but even so.. with Outlook, Outlook Express and the MSN
Client installed on this machine.. I am unable to perform a login to try and
send mail. Basically, the sample doesn't work. It reports a successful login
and then when I try and do anything it fails saying I'm not logged in.

I'm developing an opinion that this stuff isn't actually production quality.

MAPISendMessage problem, multiple workstations.

Post by Dan Mitche » Thu, 24 Feb 2005 04:38:31

=?Utf-8?B?U2hhdW4gV2lsc29u?= < XXXX@XXXXX.COM >

That's correct -- I only have Outlook installed on this machine, and I
can do Simple MAPI just fine. There's something weird about the installs
on the PCs which are having problems, but remotely diagnosing what that
weirdness is is always difficult.

Try opening IE, go to Tools | Internet Options | Programs and check
that the setting for e-mail there is correct. Also, you could try
finding and running fixmapi.exe -- it should be on your system
somewhere, I forget exactly where, but it's designed to repair broken
MAPI installations. I haven't seen it be terribly useful, but it could
be worth a go: ;en-us;228457 for more.

-- dan

MAPISendMessage problem, multiple workstations.

Post by U2hhdW4gV2 » Fri, 04 Mar 2005 10:07:02

> That's correct -- I only have Outlook installed on this machine, and I

I guess I'm into reading everything I can about MAPI next. I get a
EMODULENOTFOUND or whatever, so something mus tbe missing, and whatever it is
it's missing on 6 test machines.



Thanks, looks like I'm out of luck. I don't know what to do at this point,
not even sure where to start, so I'm going to start at the bottom and collect
everything I can about MAPI, read through the docs and I guess start dinking
with sice etc to figure out what exactly the problem is.

MAPISendMessage problem, multiple workstations.

Post by Dan Mitche » Sat, 05 Mar 2005 04:01:10

=?Utf-8?B?U2hhdW4gV2lsc29u?= < XXXX@XXXXX.COM >

This is all very confusing. You could try dependencywalker
( and see if that tells you anything, but as
Simple MAPI is all loadlibrary() you might have to start with the MAPI
dll that's being loaded and see if perhaps that's missing something, or
point it at your app and try profiling it to see what that gives.

Sorry, I can't think what else to suggest. I guess you could try with a
clean new PC, manually install Outlook (OE, whatever) on there and test
your app on that one, that way you'll know exactly what the install
environment is. Heck, you don't even need a new box for that, you could
use the 45-day trial version of virtualPC
( ) to test things

-- dan