Ozeki 10 SMS Gateway
C# SMS script C# SMS script | sendMessage sendMessage

C# SMS API reference

'SMSClient' is the namespace of the C# SMS API's class. Add the following line to include it:
'using SMSClient;'. On this page you can find useful properties, methods and events. By modifying the properties you can log into Ozeki SMS Gateway to send and receive SMS.


'mySMSClient' will be the name of the C# instance used in this reference guide.

ozSMSClient mySMSClient = new ozSMSClient();


  • Username: The name of the SMS Gateway user you would like to use for login. Default value: admin
  • Password: The password belonging to the username. Default value: abc123
  • Host: The IP address of your Ozeki SMS Gateway. Default value:
  • Port: The port number of Ozeki SMS Gateway's SMPP server. Default value: 9500
  • Connected: You can build up a connection by changing this bool value to true. Default value: false
  • KeepalivePeriod: The time to wait in seconds between pinging the SMPP server. Default value: 60
  • SocketTimeout: The time span to spend on waiting for the login PDU (in seconds). Default value: 10
mySMSClient.Username = "admin";
mySMSClient.Password = "abc123";
mySMSClient.Host = "";
mySMSClient.Port = 9500;

mySMSClient.Connected = true;


     Method name Description
sendMessage You can easily send SMS messages with this method. The recipient's phone number and the text message are mandatory parameters. You can see the parameters of 'sendMessage' by checking out this page.

sendMessage example:
mySMSClient.sendMessage("+3620123456","Hello world",

     Name Description
sendMessageEx It contains extra parameters compared to 'sendMessage', although both are capable to send SMS messages. All parameters are mandatory, but you can use "" or NULL at the following parameters: sender, serviceprovider and optionalParameterList.

sendMessageEx example:
Dictionary<string, string> HelloWorld_parameters = new Dictionary<string, string>();

HelloWorld_parameters.Add("param1", "value1");
HelloWorld_parameters.Add("vp", "2018.07.26.+10%3A07%3A58");
HelloWorld_parameters.Add("param3", "value3");

mySMSClient.sendMessageEx("+3670654321", "+3620123456", "Hello world",
	"SMS:TEXT", "SMPP0", HelloWorld_parameters);


'mySMSClient' is an example created with the constructor.

Events connected to mySMSClient
mySMSClient.OnClientConnected += new SimpleEventHandler
mySMSClient.OnClientDisconnected += new SimpleEventHandler
mySMSClient.OnClientConnectionError += new ErrorEventHandler
mySMSClient.OnMessageAcceptedForDelivery += new DeliveryEventHandler
mySMSClient.OnMessageDeliveredToNetwork += new DeliveryEventHandler
mySMSClient.OnMessageDeliveredToHandset += new DeliveryEventHandler
mySMSClient.OnMessageDeliveryError += new DeliveryErrorEventHandler
mySMSClient.OnMessageReceived += new DeliveryEventHandler

Events can be shown on the console of your C# application (Figure 1).

Figure 1 - An 'OnClientConnected' event

Now look at the detailed description of each event on the table below:

     Event name Description
OnClientConnected This event is invoked by your C# application if the connection to the SMPP server of Ozeki SMS Gateway was successful.
OnClientDisconnected It is invoked if your C# application was disconnected from the SMPP server of Ozeki SMS Gateway.
OnClientConnectionError It is invoked by your C# application if the connection to the SMPP server of Ozeki SMS Gateway was unsuccessful.
OnMessageAcceptedForDelivery It is invoked if the message is accepted for delivery by Ozeki SMS Gateway through a user. The SMS Gateway user must be connected to your C# application and the user must have enough SMS credits as well.
onMessageDeliveredToNetwork It is invoked if the GSM network provider accepts the SMS message for delivery.
onMessageDeliveredToHandset It is invoked exactly when the SMS message reaches the recipient's mobile phone. The phone can be out of coverage or can also be turned off, so this event might happen long after the 'onMessageDeliveredToNetwork' event.
OnMessageDeliveryError Message delivery error can happen in 3 different situations:
1. There is no recipient with the selected phone number.
2. There is no money on the sender's account.
3. It has been stored on the GSM server for more time then the validity period.
onMessageReceived Your Ozeki SMS Gateway can receive SMS messages too. In this case an 'onMessageReceived' event will be invoked for your C# application. This happens exactly when the message is received by a user of Ozeki SMS Gateway. This user must be connected to the C# SMS API.
Copyright © 2000- - Ozeki Ltd | info@ozeki.hu
Home > Developers guide > C# SMS API > API reference guide
Legal | Privacy | Terms of use | 5756 | | Login