The TransportRecv 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.
BOOL TransportRecv(HANDLE hService, WORD wMessageId, short sNumLines, MailMsg *MsgPtr, lpMailAttArray *lplpMaa);
Header file: | Smtp.h |
Platforms: | H/PC |
Windows CE versions: | 1.0 and later |
If only message information is to be returned, sNumLines is set to one of the following flags:
Returns TRUE if successful or FALSE otherwise. To get extended error information, call TransportError or TransportErrorMsg.
The TransportRecv function must be implemented by the transport service provider in a DLL registered as a mail service. The Inbox application can load this DLL and call this function.
For the sample transport service, TransportRecv receives a message via 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 containing 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.