logging on to MAPI with the
messages can be created and sent. The process is as follows:
Declare a variable of type
MAPIMessage and set the
values of its members.
Declare an array of
MAPIRecip and call
MAPIResolveName on each element.
If attachments are desired, declare an array of
MapiFile and set each element appropriately.
Sending attachments is covered later in this
MAPISendMail to send the message.
Example 3-1 shows how to send a message, assuming
MAPILogon function has already been called
Example 3-1. Sending a Message
Dim nRetVal As Long Dim MyMessage As MAPIMessage Dim MyRecips( ) As MapiRecip Dim MyFiles( ) As MapiFile ' Set the subject and body text. MyMessage.Subject = "Test message from Simple MAPI." MyMessage.NoteText = "This is the body text of the message." ' Add a recipient. MyMessage.RecipCount = 1 ReDim MyRecips(1 To MyMessage.RecipCount) As MapiRecip nRetVal = MAPIResolveName(nMAPISession, 0, "Annemarie", 0, 0, MyRecips(1)) ' Send the message. nRetVal = MAPISendMail(nMAPISession, 0, MyMessage, MyRecips, MyFiles, 0, 0)
datatype is defined in
mapi32.txt like this:
Type MAPIMessage Reserved As Long Subject As String NoteText As String MessageType As String DateReceived As String ConversationID As String Flags As Long RecipCount As Long FileCount As Long End Type
The member elements of this datatype are:
This member is not used and must be 0.
The subject of the message. ...