Send Feedback

The MailComposeMessage function displays a compose message form.


HRESULT MailComposeMessage(


  • pmcf
    [in] Reference to a MAILCOMPOSEFIELDS structure. The compose message form can be pre-filled by specifying values in this structure. Can be NULL if the form has no pre-filled values.

Return Values

This function returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    The call succeeded.


This function enables you to create an empty compose form and specify the fields with which to populate the form. The MAILCOMPOSEFIELDS structure specifies the fields for the form.

You can also specify which account is used to send this message. You can specify either the name of the account or the transport to use. You can also specify to send by using a mailto URL format.

This function is asynchronous. It returns before the form has been displayed, but will validate that the transport specified is correct and that the attachments specified exist. If the attachments do not exist, the function returns an appropriate error code.

Note   If a body is specified, then no signature is shown associated with the account. If no body is specified, the signature associated with the account is shown.

Only one attachment is allowed to be added to a message.

You can use the MCF_ACCOUNT_IS_TRANSPORT MAPI Compose Field flag to determine whether the account is a trasnport. For more information, see the MAILCOMPOSEFIELDS structure.


Pocket PC: Windows Mobile Version 5.0 and later
Smartphone: Windows Mobile Version 5.0 and later
OS Versions: Windows CE 5.01 and later
Header: cemapi.h
Library: cemapi.lib

See Also

MAPI Functions | Messaging | MAILCOMPOSEFIELDS | MAPI Compose Field Flags

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.