Ozeki 10 SMS Gateway
PHP SMS API PHP SMS API | C# SMS script C# SMS script

Use your C# application for SMS messaging

Your C# application can connect to a Standard User or any other user created in Ozeki SMS Gateway. You can easily prepare your C# codes to send or receive SMS messages through SMS Gateway. Below you can download source codes for two C#.NET SMS demo projects which demonstrates how easy it is to connect C# with Ozeki SMS Gateway.

This demo projects can only work if Ozeki SMS Gateway is connected to the GSM network through a GSM modem or an IP SMS connection, such as SMPP, CIMD2 or UCP/EMI.

Unzip CsNETDll_v3.zip and open the ...\CsNETDll_v3\SMSDemo directory to run SMSDemo.sln in your C# IDE.


The C# SMS API is capable to connect locally or remotely over LAN or internet to Ozeki SMS Gateway. It is a classic example how to use the .NET TCP/IP networking, so you can make two applications work together. Thanks to the advantages of the IP connectivity, it creates a client-server model, where the C# API is the client while Ozeki SMS Gateway's built in SMPP server is the server.

Please activate the SMPP server from 'Edit/Server preferences' and by clicking on the 'Client connectivity' tabpage. Now you can 'Enable the built in SMPP server' (Figure 1). The default port number is 9500. In the examples below, you will be able to connect to the port number you have provided.

Figure 1 - Enable the built in SMPP server and click 'OK'


The API comes with 2 examples, which you can download above in a single zip.

The first example project is 'SMSDemo'. Through a working GUI you can connect to a Standard User of Ozeki SMS Gateway for SMS messaging (Figure 2).

Figure 2 - GUI of 'SMSDemo' example project

The second example project is called 'SMSDemoConsole', with it you can send or receive SMS messages through a simple console, which shows the deliver status as well.

You can control 'SMSDemoConsole' by modifying the programcode. The parameters below help you to connect to any user in Ozeki SMS Gateway and send an SMS message using the 'sendMessage' method (Figure 3). You can send multiple SMS messages as well by multiplying the 'sendMessage' method.

mySMSClient.Username = "admin";
mySMSClient.Password = "abc123";
mySMSClient.Host = "";
mySMSClient.Port = 9500;

mySMSClient.Connected = true;

mySMSClient.sendMessage("+44987654", "TEST", "vp=" + DateTime.Now + "&ttt=werwerwe rewwe34232 1");

Console.ReadKey(); //Press any key
mySMSClient.Connected = false;
Figure 3 - The most important code fragment in the 'SMSDemoConsole' example. It is contained in 'Program.cs'.

Press any key to close the console.

'sendMessage' method's Validity Period parameter:
If you look back to Figure 3, above, you can see the "vp=" parameter, which represents the validity period of each message. The validity period is the time limit of the message to be stored by the service provider in case the recipient's phone is turned off. For example you can use the following parameter value:

"vp=" + 2011.07.26. + 10%3A07%3A58
Figure 4 - Validity period parameter

2018.07.26.+10%3A07%3A58 is basically 2018.07.26. 10:07:58 in an URL encoded form.

Tip: Download, install and use Microsoft Visual Studio to test these two examples.

Solutions to solve with the C# API

C# SMS API can send different type of SMS message types. For example WAP Push, Flash SMS, Ringtones, VCard, VCalendar, etc. The C# API can also subscribe to notification events, so it can help you track SMS messages. This way you can know when the message was delivered to the network if it was delivered at all and you can also know when it was received by the recipient's phone.

You can also receive SMS messages to the C# API. This helps you create great applications. For example SMS voting, stock market data querying or SMS quiz games. It is strongly recommended to read the full documentation of the C# API on the following page: C# SMS API Reference

Here is an alternative solution through SQL:

Connecting your C# API to a Database User through your SQL database.