Our application uses Simple MAPI to send e-mails. One of our clients has problems sending e-mail from a session on his terminal server.
The mapi32.dll is loaded with a call to LoadLibrary which succeeds, but then our application tries to get the addresses of the functions MAPILogon
, MAPILogOff
, MAPISendMail
, MAPIFreeBuffer
and MAPIResolveName
. The problem is that GetProcAddress
fails for those functions with an ERROR_ACCESS_DENIED
(code: 5) except for MAPIFreeBuffer
. It looks like some sort of security thing.
How can I fix this or should I use another method to send mail?
FWI, here some more information about OS and contents of registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem:
OS info: 5.2.3790 VER_PLATFORM_WIN32_NT Service Pack 2
Contents of SOFTWARE\Microsoft\Windows Messaging Subsystem
InstallCmd: rundll32 setupapi,InstallHinfSection MSMAIL 132 msmail.inf
MAPI: 1
CMCDLLNAME: mapi.dll
CMCDLLNAME32: mapi32.dll
CMC: 1
MAPIX: 1
MAPIXVER: 1.0.0.1
OLEMessaging: 1
Contents of SOFTWARE\Microsoft\Windows Messaging Subsystem\MSMapiApps
inetsw95.exe:
choosusr.dll:
msab32.dll:
nwab32.dll:
outstore.dll: Microsoft Outlook
CDOEXM.DLL:
EMSMDB32.DLL:
EMSABP32.DLL:
newprof.exe: Microsoft Outlook
outlook.exe:
wfxmsrvr.exe: Microsoft Outlook
msexcimc.exe:
exchng32.exe:
schdmapi.dll: Microsoft Outlook
pilotcfg.exe: Microsoft Outlook
mailmig.exe: Microsoft Outlook
admin.exe:
msspc32.dll: Microsoft Outlook
cnfnot32.exe: Microsoft Outlook
ilpilot.exe: Microsoft Outlook
events.exe:
I'm on Delphi 7.0, but that shouldn't matter.
Edit, added version information:
Fileversion info of C:\WINDOWS\system32\mapi32.dll
Fileversion: 6.5.7226.0
FileDescription=Extended MAPI 1.0 for Windows NT
CompanyName=Microsoft Corporation
InternalName=MAPI32
Comments=Service Pack 1
LegalCopyRight=Copyright (C) 1986-2003 Microsoft Corp. All rights reserved.
LegalTradeMarks=Microsoft(R) and Windows(R) are registered trademarks of Microsoft Corporation.
OriginalFileName=MAPI32.DLL
ProductName=Microsoft Exchange
ProductVersion=6.5
Fileversion info of C:\Program Files\Common Files\SYSTEM\MSMAPI\1043\msmapi32.dll
Fileversion: 11.0.5601.0
FileDescription=Extended MAPI 1.0 for Windows NT
CompanyName=Microsoft Corporation
InternalName=MAPI32.DLL
LegalCopyRight=Copyright © 1995-2003 Microsoft Corporation. All rights reserved.
OriginalFileName=MAPI32.DLL
ProductName=MAPI32
ProductVersion=11.0.5601
I found the problem. As you can see in my question the mapi32.dll is provided by Exchange server. (Version 6.5.7226 = Microsoft Exchange Server 2003 SP1). According to this site Exchange 2003 does not support Simple MAPI for security reasons:
So that is the reason I cannot get the ProcAddresses of the Simple MAPI calls.
It looks like I have to go support Extended MAPI.
I think it's a problem of mixed versions of mapi32.dll. Such as maybe Office2003 and 2007 on the same machine, or a botched uninstall/re-install crossing versions (i.e. tried to uninstall 2007 and go back to 2003, or vice-versa). Have the client search the entire HD for mapi32.dll and see if there are multiple versions. If there's only one, compare the version to a known, working system.
See this: http://www.techtalkz.com/microsoft-outlook/391309-mapi32-dll-error-help-my-kids-xms-gift-broken.html