The Messaging Application Program Interface (MAPI) is a set of functions that developers can use to create Mail-enabled applications. Mail includes a subset of 12 functions called Simple MAPI, which enable developers to send, address, and receive messages from within Windows-based applications.
With Simple MAPI functions, developers can easily add the power of messaging to any Windows-based application. Simple MAPI supports the standard interface for simple integration of a Windows-based application with Mail.
All of the Simple MAPI functions are designed to be called from C or C++ programs, but they can also be called from high-level languages, such as Visual Basic®, Actor®, Smalltalk®, and ObjectVision®. Simple MAPI functions can also be called from applications with macro languages that can call a DLL. Two examples of these are Microsoft Excel for Windows or Microsoft Word for Windows.
Some Simple MAPI functions include a user interface (a dialog box) but can also be called without generating an interface. The seamless integration with Mail is convenient for applications such as word processors and spreadsheets, which manipulate files that users may want to exchange through Mail. The style of the user interface is not defined by Simple MAPI, so you can design your own.
An application developer can incorporate Mail functionality into their application by calling the MAPI functions. For example, if an application creates data files that need to be distributed to other users in a workgroup, the application developer can use the MapiSendDocuments() function to create a mail message and to send the data files as an attachment to the message. Sending mail messages is fully controlled from the application and the MAPI support library (MAPI32.DLL). The user doesn't need to have the Mail program running to do this.
In this case, one function call is all that is required. The MapiSendDocuments() function creates and initializes a message and supplies all the standard Mail dialog boxes for the user to send messages. The function can be compiled into the native code of the application, or if the application includes a macro facility that can link to a DLL, the developer can integrate the DLL as an added macro command.
Simple MAPI consists of the following functions:
Table 8.1 Simple MAPI Functions
Function | Description |
MapiAddress() | Addresses a Mail message. |
MapiDeleteMail() | Deletes a Mail message. |
MapiDetails() | Displays a recipient details dialog box. |
MapiFindNext() | Returns the ID of the next (or first) Mail message of a specified type. |
MapiFreeBuffer() | Frees memory allocated by the messaging system. |
MapiLogoff() | Ends a session with the messaging system. |
MapiLogon() | Begins a session with the messaging system. |
MapiReadMail() | Reads a Mail message. |
MapiResolveName() | Displays a dialog box to resolve an ambiguous recipient name. |
MapiSaveMail() | Saves a Mail message. |
MapiSendDocuments() | Sends a standard Mail message. |
MapiSendMail() | Sends a Mail message. |