MailComposeMessage (Compact 7)
3/12/2014
The MailComposeMessage function begins the message composition process by invoking either the Messaging Account Picker or the Compose Message Card, for the user.
Syntax
HRESULT MailComposeMessage(
MAILCOMPOSEFIELDS* pmcf
);
Parameters
- pmcf
[in] Reference to a MAILCOMPOSEFIELDS structure. The Messaging Application displays either the Account Picker, or a Compose Message Card-which one depends on the values in this structure. Additoinally, the Compose Message Card can be pre-filled with the values in this structure. Can be NULL if the card has no pre-filled values.
Return Value
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.
Remarks
This function enables you to invoke the message composition process in one of three ways, depending on the values you set for MAILCOMPOSEFIELDS members:
- Restrict users to creating new e-mail messages, and allow them to pick an e-mail account to use.
- Restrict users to creating new SMS messages, and immediately invoke the SMS Compose Message Card.
- Allow users to choose between E-mail and SMS. If they chose to create a new e-mail message, then they would pick an e-mail account to use. If they chose to create a new SMS message, then the SMS Compose Message Card would appear.
This function enables you to create an empty compose card and specify the fields with which to populate the card. The MAILCOMPOSEFIELDS structure specifies the fields for the card.
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 card 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 transport. For more information, see the MAILCOMPOSEFIELDS structure.
Code Example
The following code example shows the MAILCOMPOSEFIELDS values that you would set if you wanted the user to choose the messaging account to use, while also excluding the SMS transport.
mcf.pszAccount = NULL;
mcf.dwFlags = MCF_MAILTO_FORMAT;
Comments
You can restrict the user to sending e-mail only by using a mailto URL format. This is useful when you want to send long e-mail messages, or when you want to allow multiple recipients (which does not work with SMS messages).
Code Example
The following code example shows the MAILCOMPOSEFIELDS values to set to specify that the message be sent from a particular messaging account.
mcf.pszAccount = TEXT("ActiveSync");
mcf.dwFlags = MCF_ACCOUNT_IS_TRANSPORT;
Comments
You can specify either the name of the account, or the transport.
Requirements
Header |
cemapi.h |
Library |
cemapi.lib |