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 where the size of the newly allocated message body buffer is copied to.
ppbBuffer
[out] Pointer to where the address of the newly allocated message body buffer is copied to.

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
pForm 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

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mqmail.h.
  Import Library: Use mqmail.lib.
  Unicode: Defined only as Unicode.

See Also

MQMailEMail, MQMailFreeMemory