Platform SDK: Message Queuing

MQMailComposeBody

The MQMailComposeBody function composes a message body from information provided by an e-mail data structure. The message body is formatted in MSMQ mail format.

STDAPI MQMailComposeBody(
  LPMQMailEMail pEMail,  
  ULONG FAR *pcbBuffer,  
  LPBYTE FAR  ppbBuffer  
);

Parameters

pEMail
[in] Pointer to an MQMailEMail structure that contains mail information.
pcbBuffer
[out] Pointer to the location of the size of the newly allocated message body buffer.
ppbBuffer
[out] Pointer to the address of the newly allocated message body buffer.

Return Values

S_OK
Indicates success.
E_INVALIDARG
Invalid arguments.
Other system errors
Use the FAILED(hr) macro to test for errors.

Remarks

The MQMailComposeBody function is used to create the body of an MSMQ mail message. It allocates a message body buffer and fills it with an MSMQ mail format representation of the data specified by the pEMail parameter.

Mail messages can be sent to MAPI clients via the MSMQ MAPI Transport Provider, Microsoft® Exchange users via the MSMQ Exchange Connector, or other MSMQ applications.

When this function succeeds, the application must free the memory allocated for the message body buffer by calling MQMailFreeMemory after the buffer is used.

The following table defines which members of the MQMailEMail structure are required to compose a message body for each type of e-mail. Required properties are marked with an X (default values can be used). When composing an e-mail object, all required members must have valid values, otherwise an error condition is raised by MQMailComposeBody.



MQMailEMail

Text
Message


Form


Tnef

Delivery
Report
Non-
Delivery
Report
pFrom X X      
szSubject X (Empty string) (Empty string)
fRequestDeliveryReport X (False) X (False)
fRequestNonDeliveryReport X (False) X (False)
pftDate X (Current time) X (Current time) X (Current time) X (Current time)
pRecips X X X X X
iType X X X X X
form   X      
message X  
tnef   X
DeliveryReport   X
NonDeliveryReport   X

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP3 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Mqmail.h.
  Library: Use Mqmail.lib.

See Also

MQMailEMail, MQMailFreeMemory