Share via


SmsSendMessage

Send Feedback

Use the SmsSendMessage function to create and send an Short Message Service (SMS) message.

HRESULT SmsSendMessage (
const SMS_HANDLE smshHandle,
const SMS_ADDRESS * const psmsaSMSCAddress,
const SMS_ADDRESS * const psmsaDestinationAddress,
const SYSTEMTIME * const pstValidityPeriod,
const BYTE * const pbData,
const DWORD dwDataSize,
const BYTE * const pbProviderSpecificData,
const DWORD dwProviderSpecificDataSize,
const SMS_DATA_ENCODING smsdeDataEncoding,
const DWORD dwOptions,
SMS_MESSAGE_ID * psmsmidMessageID);

Parameters

  • smshHandle
    An SMS handle obtained from calling SmsOpen.

  • psmsaSMSCAddress
    An optional parameter indicating which Short Message Service Center (SMSC) the message will be routed through. If NULL (recommended), the user's default SMSC will be used.

  • psmsaDestinationAddress
    The destination of the message.

  • pstValidityPeriod
    The duration for which the SMS message is valid, counted from when the SMSC receives the message. This can be NULL. This is not interpreted as a normal SYSTEMTIME structure. See GSM specification 03.40 "Digital cellular telecommunications system (Phase 2+); Technical realization of the Short Message Service (SMS)" for more detail.

  • pbData
    The data portion of the message. This can be NULL.

  • dwDataSize
    Size in bytes of the buffer pointed to by pbData. This can be zero.

  • pbProviderSpecificData
    For certain providers, a provider-specific structure must be provided in addition to the previous data buffer.

  • dwProviderSpecificDataSize
    Size of pbProviderSpecificData.

  • smsdeDataEncoding
    The text encoding of the SMS message, if appropriate. SMSDE_OPTIMAL is the recommended value. See the SMS_DATA_ENCODING enumeration for possible values.

  • dwOptions
    Optional flags.

    Value Description
    SMS_OPTION_DELIVERY_NONE No special options
    SMS_OPTION_DELIVERY_NO_RETRY Unless this option is specified, the router will retry sending the SMS message according to a pre-defined short-term retry schedule. If this option is specified, no retries will be attempted.
  • psmsmidMessageID
    If not NULL, this will point to a message ID on successful return from SmsSendMessage. This identifier can be used with SmsGetMessageStatus to identify the message.

Return Values

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

  • S_OK
    The method completed successfully.

For information about additional return values, see SMS Specific Errors and SMS General Errors.

Remarks

You can also create SMS messages with the Windows CE Mail API (CEMAPI). If you do, the message contents is contained in the CEMAPI messaging property tag PR_SUBJECT.

Note   This means that you cannot access the message content with the PR_BODY property tag — you must use the PR_SUBJECT property tag instead.

Requirements

Smartphone: Smartphone 2002 and later
Pocket PC: Pocket PC 2002 and later
OS Versions: Windows CE 3.0 and later
Header: sms.h
Library: sms.lib

See Also

Short Message Service Functions | SmsOpen | SMS_DATA_ENCODING | SmsGetMessageStatus

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.