CMC, Simple MAPI, and Extended MAPI provide the required API calls for messaging applications. These calls work with a second level of MAPI features called the messaging subsystem. The messaging subsystem, which is part of the computer's operating system, responds to the API calls and performs the requested actions. It is called a subsystem because it is a subset of the entire operating system.
Figure 11.1 How MAPI is used to create messaging-enabled applications
The MAPI messaging subsystem divides tasks related to handling multiple transport service providers. Drivers for each transport (in the form of a Windows DLL) provide the interface between the MAPI messaging subsystem and the back-end messaging system called the Service Provider Interface (SPI).
MAPI's open architecture allows information from a variety of services, such as fax, bulletin boards , and e-mail, to be used easily with any MAPI client application. In Windows, users can select the service provider drivers for the desired back-end services.
Because of these drivers, client applications can work with multiple messaging systems, such as Microsoft Mail, Novell MHS, and IBM PROFS, at the same time without being customized for each system.
MAPI controls allow you to create mail-enabled Visual Basic MAPI applications. There are two MAPI controls:
The MAPIMessages control performs a variety of messaging system functions after a messaging session is established with the MAPISession control.
Example
This example opens an e-mail message in Visual Basic using the MAPISession andMAPIMessages controls:Private Sub GetLastMessage_Click() Dim strHeader As String 'Log on, set the message session, and fetch mail. MAPISession1.Action = mapSignOn MAPIMessages1.SessionID = MAPISession1.SessionID MAPIMessages1.Fetch 'set message index to the last 'email message in the Inbox. MAPIMessages1.MsgIndex = MAPIMessages1.MsgCount - 1 strHeader = "FROM: " & MAPIMessages1.MsgOrigDisplayName strHeader = strHeader & " SUBJECT: " & _ MAPIMessages1.MsgSubject 'Display a message box to display the message 'content, and log off. MsgBox MAPIMessages1.MsgNoteText, , strHeader MAPISession1.Action = mapSignOff End Sub
NoteFor more information, go to Microsoft's MAPI Web site (www.microsoft.com/win32dev/mapi/).