MAPISendMailHelper function (mapiunicodehelp.h)
Takes Unicode message information and sends the message using MAPISendMailW or, if necessary, converts the message to ANSI and sends the message using MAPISendMail. On Windows 8 and later: Call MAPISendMailW directly to send a message.
ULONG MAPISendMailHelper( [in] LHANDLE lhSession, [in] ULONG_PTR ulUIParam, [in] lpMapiMessageW lpMessage, [in] FLAGS flFlags, [in] ULONG ulReserved );
Handle to a Simple MAPI session or zero.
If the value of the lhSession parameter is zero, MAPI logs on the user and creates a session that exists only for the duration of the call. This temporary session can be an existing shared session or a new one. If necessary, the logon dialog box is displayed.
Parent window handle or zero.
If the value of the ulUIParam parameter is zero and a dialog box is displayed, the dialog box is application modal. If the ulUIParam parameter contains a parent window handle, it is of type HWND (cast to a ULONG_PTR). If no dialog box is displayed during the call, ulUIParam is ignored.
Pointer to a MAPISendMailW structure containing the message to be sent.
If the registered mail provider requires the message to use ANSI encoding, MAPISendMailHelper converts this message to the ANSI MapiMessage structure calls MAPISendMail to send the message.
When you call the function, please note the following information about message structure members:
|lpFiles||Set this member to NULL when the message does not have file attachments.|
|lpszMessageType||Used by applications that do not handle interpersonal messages. If your application handles interpersonal messages, set the lpszMessageType member to NULL or set it to point to an empty string.|
|lpszSubject||A value of NULL means that there is no text for the subject of the message.|
|lpszNoteText||A value of NULL means that there is no text in the body of the message.|
|lpRecips||A value of NULL means that there are no recipients. Additionally, when this member is NULL, the nRecipCount member must be zero.|
|nRecipCount||A value of zero means that there are no recipients. Additionally, when this member is zero, the lpRecips member must be NULL.|
For more details about how the function handles recipient information, see Handling recipient information in MAPISendMailW.
Bitmask of option flags. The following flags can be set.
Reserved; must be zero.
This function returns one of the following values.
||A recipient matched more than one of the recipient descriptor structures and MAPI_DIALOG was not set. No message was sent.|
||The specified attachment was not found. No message was sent.|
||The specified attachment could not be opened. No message was sent.|
||The type of a recipient was not MAPI_TO, MAPI_CC, or MAPI_BCC. No message was sent.|
||One or more unspecified errors occurred. No message was sent.|
||There was insufficient memory to proceed. No message was sent.|
||One or more recipients were invalid or did not resolve to any address.|
||There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed. No message was sent.|
||The text in the message was too large. No message was sent.|
||There were too many file attachments. No message was sent.|
||There were too many recipients. No message was sent.|
The MAPI_FORCE_UNICODE flag is specified and Unicode is not supported.
Note This value can be returned only if MAPISendMailW is called to send the message.
||A recipient did not appear in the address list. No message was sent.|
||The user canceled one of the dialog boxes. No message was sent.|
||The call succeeded and the message was sent.|
For more information about MAPI send mail functions, see MAPISendMailW.