Home
RECOMMENDED FOR YOU:
SMS Gateway software
Ozeki brings you outstanding
SMS Gateway technology. Use our SMS Server products on Windows,Linux, or Android

C# SMS API
Developers can use our C# SMS API to send SMS from C#.Net. The C# SMS API comes with full source code

PHP SMS API
The ozeki PHP SMS gateway software can be used to send SMS from PHP and to receive SMS usig PHP on your website

SMPP SMS Gateway
SMS service providers use our SMPP gateway solution, that offers a high performance SMPP server and SMPP client gateway with amazing routing capabilities
Ozeki 10 SMS Gateway

How to send sms from c# with smpp

This page demonstrates how to send sms from c# with smpp. It will start with clearing up the term of what c# with smpp is and will continue with the explanation of how it can be used. C# with smpp is a great tool to send sms, it can be used in various environments. This guide is useful for c# developers. Maybe the biggest advantage of this smpp api solution is that all you have to do is perform some configuration and you will be ready to send sms messages in a short period of time. The smpp api with c# sms example is based on Ozeki SMS Gateway, so you can take advantage of that fact that it offers excellent logging capabilities, which means you can track down errors quickly. We presume your are familiar with the basics of SMS technology and the c# programming. You will be provided some valuable information and well structured step by step instructions.

What is c# smpp?

C# smpp is a method to send sms messages from a c# application using the smpp protocol. It is used by c# software developers in windows services, windows desktop applications and c# driven websites.

how to send text from c sharp with smpp
Figure 1 - Send text message from c sharp with smpp

Detailed instructions to send sms from c# with smpp

To send sms from c# with smpp:

  1. Start the Ozeki management console
  2. Create an SMPP Client connection
  3. Create an SMS API user for your c# app
  4. Open 'Add new user/application...'
  5. Scroll down to http user
  6. Click 'install'
  7. Create an sms route from c# to smpp
  8. Copy the c# sms example into visual studio
  9. To send your first text, run the project

How to Use SMPP to send SMS?

SMPP (Short Message Peer-to-Peer) is a protocol used by the telecommunications industry. It exchanges SMS messages between (SMSC) and Ozeki SMS gateway. SMSC acts as middleman to store the message and route it. Ozeki SMS gateway is the system that delivers SMS to SMSC. To use Ozeki SMS gateway to connect to the mobile network using SMPP you need to setup an secure SMPP Client connection.

C# requirements and resources

C# is a programming language and can be used to quickly and easily add SMS support for programmatically sending and receiving text messages. Use it for transactional messaging and notifications between your application and mobiles. The following are required to send SMS using C#:

  • Visual Studio
  • Ozeki c# sms example code
  • SMS api account created in Ozeki SMS Gateway
  • SMPP Client connection configured in Ozeki SMS gateway

C# SMS source code example

The following example C# source code is free to use, you can simply implement it into your project or you can modify the source code to use it for other projects or applications. If you would like to run this example code, you just need to copy-paste it into your Console App project and run the project.

using System;
using System.Net.Http;
using System.Text;
using System.Web;
namespace HttpApiTester
{
    class Program
    {
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            var username = "john";
            var password = "Xc3ffs";
            var messagetype = "SMS:TEXT";
            var httpUrl = "https://127.0.0.1:9508/";
            var recipient = HttpUtility.UrlEncode("+36201324567", Encoding.UTF8);
            var messagedata = HttpUtility.UrlEncode("TestMessage", Encoding.UTF8);
            
            var sendString = $"{httpUrl}api?action=sendmessage&username=" +
                             $"{username}&password={password}" +
                             $"&recipient={recipient}&messagetype=" +
                             $"{messagetype}&messagedata={messagedata}";

            Console.WriteLine("Sending request: " + sendString);

            var handler = new HttpClientHandler();
            handler.ServerCertificateCustomValidationCallback = 
                (sender, cert, chain, sslPolicyErrors) => { return true; };

            using var client = new HttpClient(handler);

            try
            {
                var response = await client.GetStringAsync(sendString);
                Console.WriteLine("Http response received: ");
                Console.WriteLine(response);

            } catch(Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}

Testing

For testing your application's SMS support when using the SMPP protocol, we recommend starting with the Ozeki SMPP simulator configuration to simulate SMS message delivery to mobiles (MT SMS) and simulate SMS messages from mobiles (MO SMS). The SMSC Simulator supports SMPP v3.3, v3.4 and v5.

For live testing and delivery to mobiles, you can use the reliable and dependable Ozeki SMS gateway with an android sms gateway setup.

To sum it up

We hope you didn’t get lost in the explanations. We did our very best to make it simple and to walk you through all the details as painlessly as possible. By following the above tutorial steps you can create the solution in a short period of time. Now you can use c# with smpp to send texts. You have seen the advantages Ozeki SMS Gateway can bring. If you have already completed the steps you can enjoy a well deserved coffee or some other treat you have in mind. If you would like to find out more about the benefits of other smiliar solutions, please open ozeki-sms-gateway.com. I hope this article will be useful to all the readers and especially to beginners.

More information