This page gives you information on how you
can use C# to send/receive
SMS messages. A C#.NET SMS demo project is provided with full source code,
that illustrates how to connect to Ozeki NG - SMS Gateway. The demo project
makes it possible to send/receive SMS
messages using a GSM Modem or an IP SMS connection, such as SMPP,
CIMD2 or UCP/EMI. In my previous article
( How to send SMS messages from C# using an SQL database ) I have explained how you can send/receive
SMS messages from C# using databases. The information I present
here is useful if you would like to Interface directly with the SMS gateway
without a database server.
To get started using this C#.Net example, you need to download the example
project by clicking on the following link. In this zip file you will find
the source code of the project explained in this document.
The C# SMS API is a client software, that
can be used to connect to Ozeki NG - SMS Gateway directly to send and receive
SMS messages from any C#.NET application. The API can be used to connect locally
or remotely (over a LAN or the Internet) to the
SMS Gateway. The API provides a classic example on how to use the .NET TCP/IP
to make two applications (Your application and the SMS Gateway) work together.
It uses the advantages provided by IP connectivity to create a client-server
model. The API comes with an example. The C# SMS example is a working GUI
that can be used to send and receive SMS messages to get information about
delivery status (Figure 1).
How to use the C# SMS API
To use the C# SMS API you must have a working installation of Ozeki NG SMS
in your system. To get a working installation, you need to follow the steps
in the Ozeki SMS Gateway installation guide and
the steps in the SMS quick start guide
to verify if sending and receiving works.
After you have a working SMS gateway, you can
and extract the C# SMS client. Note, that Ozeki NG SMS Gateway does not
necessary have to be installed on the same computer where your C# SMS
is running. You can have Ozeki NG SMS Gateway on one computer and you can use
Visual Studio to build your C# SMS application on a different computer.
The C# SMS API reference
The C# SMS API provides methods that allow you to send various message types,
such as WAP Push, Flash SMS, Ringtones, VCard, VCalendar, etc. It also
has events that help you track your SMS messages. For example you can subscribe
for a notification about when a message was delivered to the network and
when a message was delivered to the handset. The C# SMS API can also be
used to receive SMS messages. This gives you the option to create applications
like SMS voting, quiz games, or stock market data querying quickly. A complete
documentation of the C# SMS API is available on the following webpage:
In order to use the C# api, you need to configure the SMPP server in
Ozeki NG SMS Gateway. You will need to setup an SMPP user account that
can be used by the C# client to send and receive SMS messages.
Client side configuration
Once you have created the server side configuration, you need to enter
the appropriate server details into the code of the C# SMS client. You will
enter the IP address and port of the server, and the username and password.
Testing your code
You can test your code and send your first message by launching the project in Visual Studio.
Simply click on the build button, and the application will start.
Reading the logs
After sending your first SMS messages, we recommend you to read the logs
in the Ozeki NG SMS Gateway user interface. You can do this by opening the
details page of the SMS gateway.
How to specify the validity period for your messages
Ozeki NG SMS Gateway allows you to send SMS messages from various applications. If you use C# SMS API for sending messages, you can set the
validity period for your messages. For specifying the validity period, please use
the following parameter:
Please note that 2022.07.26.+10%3A07%3A58 is the Urlencoded form of 2022.07.26. 10:07:58.
With the use of this parameter, you can send validity information to the service provider. Therefore, the service provider can set messages to be valid for the specified period.