C# SMS API - sendMessage method

This method can be used to post an SMS message to the SMS Gateway. It has several overloads that give you a lot of flexibility.

     Name Description
method string sendMessage(string receiver, string message); Sends a text SMS message to the recipient phone. You need to specify the receiver phone number and the message text.

Parameters

receiver - The recipient phone number. It can be specified in International format (starting with a leading plus sign and country code) or in Local number format.

message - The message text. The message text can be longer then 160 characters and can contain unicode characters. If the message text is long the message will be sent in more then one parts by the gateway (multipart sms). If the message text cannot be encoded int the GSM 7bit alphabet it will be sent as unicode SMS message.

Returns

A unique message id - This id is used in the onMessageDeliveredToNetwork and onMessageDeliveredToHandset events.

Example

string id = sendMessage("+36205464567","Hello world");
method string sendMessage(string sender, string receiver, string message); Provides the same functionality as above and makes it possible to specify the sender phone number. Please note that the sender phone number can be modified in IP SMS connections only. If you use a GSM Modem to send SMS messages you cannot change the sender phone number in the message.

Parameters

sender - The sender phone number. This can be a phone number in International or local number format or an alphanumeric string with a maximum length of 11 characters.

receiver - The recipient phone number.

message - The message text.

Returns

A unique message id - This id is used in the onMessageDeliveredToNetwork and onMessageDeliveredToHandset events.

Example

string id = sendMessage("+36201115555","+36205464567","Hello world");
method string sendMessage(string sender, string receiver, string message, string messagetype);

This overload makes it possible to send text and binary messages such as WAP PUSH, oplogos, ringtones, etc.

Parameters

sender - The sender phone number.

receiver - The recipient phone number.

message - The SMS message text or the binary SMS message data. The binary message data is usually represented as an XML. The format of the XML is determined by the SMS message type.

messagetype - The message type, that determines the format of the message. By selecting the appropriate message type you can send a FLASH SMS, a binary SMS or any other special SMS content. For more information on available message types, see our Appendix J - SMS Message Types.

Returns

A unique message id - This id is used in the onMessageDeliveredToNetwork and onMessageDeliveredToHandset events.

Example

string id = sendMessage("+36201115555","+36205464567","Hello world","SMS:TEXT");

method string sendMessage(string sender, string receiver, string message, string messagetype, string serviceProvider); This overload provides the same functionality as above and it gives you an option to select which service provider connection should be used to send the message.

Parameters

sender - The sender phone number.

receiver - The recipient phone number.

message - The SMS message text or the binary SMS message data.

messagetype - The message type.

serviceProvider - The serviceprovider name. For example when you create an SMPP connection you can define the service provider name on the configuration form. If you use the specified name in this function, you can make sure the specified service provider connection will be used to transmit the message. (Hint: You should check the "Allow routing table override" checkbox in the advanced tab of the user configuration form in the SMS gateway to allow this functionality to override the routing table of the server.)

Returns

A unique message id - This id is used in the onMessageDeliveredToNetwork and onMessageDeliveredToHandset events.

Example

string id = sendMessage("+36201115555","+36205464567","Hello world","SMS:TEXT","SMPP0");

More information