This function gets a specific message from the mail server. The number of MailMsg messages that can be retrieved is between 1 and the number returned by TransportCount.
At a Glance
Header file: | Smtp.h |
Windows CE versions: | 1.0 and later |
Syntax
BOOL TransportRecv(HANDLE hService, WORD wMessageId,
short sNumLines, MailMsg *MsgPtr, lpMailAttArray *lplpMaa);
Parameters
hService
[in] Handle to a SERVICE structure.
wMessageId
[in] Identifier of the message for this session. If this value is zero, the unique message identifier stored in the szSvcId member of the MailMsg structure is used.
sNumLines
[in] Number of lines to receive. For the sample service, sNumLines is assigned value indicating the number of lines to be read.
If only message information is to be returned, sNumLines is set to one of the following flags:
Value | Description |
TRANSPORT_MSG_EXIST | Used to check for the existence of a message, without allocating any memory. Neither the message header nor the message body is read. |
TRANSPORT_ALL_LINES | Returns the unique identifier stored in the szSvcId member of the MailMsg structure as determined from wSessionId. |
TRANSPORT_HEADERS | Parses the message header and places the information in MsgPtr, also without allocating any memory. The message body is not read. |
MsgPtr
[in] Pointer to MailMsg structure that receives the message information.
lplpMaa
[in] For Windows CE versions 1.0 and 1.01, this parameter is reserved; set to NULL. For versions 2.0 and later, it is a long pointer to lpMailAttArray, which is itself a long pointer to a MailAttArray structure.
Return Values
TRUE indicates success. FALSE indicates failure. To get extended error information, call TransportError or TransportErrorMsg.
Remarks
The transport service provider must implement the TransportRecv function in a DLL registered as a mail service. The Inbox application can then load this DLL and call this function.
For the sample transport service, TransportRecv receives a message by means of hService and copies the message (or message information) into the MsgPtr structure. If the calling application wishes only to check for the existence of the message, or just obtain header information, the calling application sets sNumLines to TRANSPORT_MSG_EXIST.
A typical TransportRecv routine opens the file that contains the message (specified in hService), allocates heap space, parses the header, and fills the various MsgPtr fields with the appropriate information. After assigning pointers to the heap, header, and body fields of MsgPtr, the sample TransportRecv frees the memory allocated to MsgPtr, but leaves the heap it created intact. The heap must be destroyed by using TransportFreeMsg.
If the lplpMaa parameter returns a valid pointer and the transport determines that attachments are to be added to the message, then a MailAttArray structure should be allocated from the message heap and initialized with appropriate attachment information.
See Also