PRB: You Receive the MAPI_E_FAILURE (2) MAPI Result Code If You Use Some Hotmail Simple MAPI functions

Article translations Article translations
Article ID: 315500 - View products that this article applies to.
This article was previously published under Q315500
Expand all | Collapse all

SYMPTOMS

If you have Microsoft MSN Hotmail set as your default e-mail client, you may receive the MAPI_E_FAILURE (2) MAPI result code when you call Simple MAPI functions other than MAPISendMail, MAPILogon, and MAPILogoff. You may also receive with MAPI_E_FAILURE (2) MAPI result code if you use a Microsoft Visual Basic code to call the MAPISendMail function.

CAUSE

This behavior can occur because the Hotmail Simple MAPI that is included with Microsoft Internet Explorer and that is contained in the Hmmapi.dll file only implements the three functions exported as MAPISendMail, MAPILogon, and MAPILogoff. All other Simple MAPI functions that are exported by the Hmmapi.dll file return the MAPI_E_FAILURE (2) MAPI result code.

This includes the BMAPI functions, such as BMAPISendMail, which are typically exported by Simple MAPI implementations to allow Visual Basic programs to call them. The BMAPI functions use simpler structures that Visual Basic can understand. Hotmail does not implement any of the BMAPI functions. Any call to them returns with the MAPI_E_FAILURE (2) MAPI result code.

RESOLUTION

To resolve this behavior, limit the use of Simple MAPI to the MAPISendMail function and do not use the BMAPI functions if you are using Hotmail as your default e-mail client.

STATUS

This behavior is by design.

MORE INFORMATION

Hotmail provides a Simple MAPI implementation in the following file:
%Program Files%\Internet Explorer\Hmmapi.dll
If you are using Hotmail as your default e-mail client, then the following key
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail::(default)
will be set to HotMail.

This causes the MAPI Stub Library (the Mapi32.dll file) to route Simple MAPI calls to the Hmmapi.dll file.

A client program can link directly to the functions in the Hmmapi.dll file by calling LoadLibrary. It is not recommended that you use this method.

The following list describes how each of the implemented Simple MAPI functions operate:
  • MAPILogon: Sets lhSession to 1, and returns SUCCESS_SUCCESS.
  • MAPILogoff: Always returns SUCCESS_SUCCESS
  • MAPISendMail: Ignores lhSession. Ignores all flags, including MAPI_DIALOG. Invokes Internet Explorer to create a message in a compose window by using the passed in MapiMessage structure, including all recipients and attached files. The message is created and presented in the browser, but it is not automatically sent. You must manually send the message. Because this function invokes a user interface, do not use it from a service.

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
163216 Updated Mapivb32.bas for Simple MAPI on 32-Bit Platforms
315458 PRB: Simple MAPI BMAPI Functions Might Not Work With MAPI Stub Library

Properties

Article ID: 315500 - Last Review: March 19, 2004 - Revision: 4.2
APPLIES TO
  • Microsoft Office Outlook 2007
  • Simple Messaging Application Programming Interface (MAPI)
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.5
  • Microsoft Internet Explorer (Programming) 6.0
Keywords: 
kbprb KB315500

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com