SMS API: How to send SMS using C#

send sms using c#, send sms using c# windows application, send sms using c# gsm modem, send sms using c#, send sms using c# MVC


SMS stands for Short Message Service is widely used to communicate to another mobile devices. Earlier, provided resolution to resolve issue Authentication the Server Response was 5.5.1 Authentication required in gmail, now today explaining how to send SMS using C#. We can send SMS up to 160 characters through our mobile devices. Long message can split up into small multiple parts automatically. On mobile device can send text message only. Here, I am exposing how to send text SMS (Short Message Service) using c# code.
  1. First of all. We need to create an URL to send text message on mobile device.
  2. We require web or IP address with parameters like username, password, recipient, senderid, text message and response etc.
  3. Parameters can vary depend on SMS provider service. Providers provide complete information to send SMS.
  4. Now we need to create web request to send SMS using C# code.
  5. We can also track response after sending text message on mobile device.

Code Snippet

public ActionResult SendSMSInCsharp()
    //we creating the necessary URL string:
    string _URL = "192.168.1"; //where the SMS Gateway is running
    string _senderid = "TESTTC";   // here assigning sender id 
    string _user = HttpUtility.UrlEncode("TestSMS"); // API user name to send SMS
    string _pass = HttpUtility.UrlEncode("123456");     // API password to send SMS
    string _recipient = HttpUtility.UrlEncode("9999999999");  // who will receive message
    string _messageText = HttpUtility.UrlEncode("testing sms..."); // text message

    // Creating URL to send sms
    string _createURL = _URL + 
    "username =" + _user +
       "&pass=" + _pass +
       "&senderid=" + _senderid +
       "&dest_mobileno=" + _recipient +
       "&message=" + _messageText;

        // creating web request to send sms 
        HttpWebRequest _createRequest = (HttpWebRequest)WebRequest.Create(_createURL);
        // getting response of sms
        HttpWebResponse myResp = (HttpWebResponse)_createRequest.GetResponse();
        System.IO.StreamReader _responseStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
        string responseString = _responseStreamReader.ReadToEnd();
    return View();


SMS (Short Message Service) is now used across the world through mobile devices to instant communication medium. In this article, demonstrated explained all steps to send SMS using C# code. You can send SMS through this code in ASP.Net, MVC using C# code.

Suggested Reading


Anjan kant

Outstanding journey in Microsoft Technologies (ASP.Net, C#, SQL Programming, WPF, Silverlight, WCF etc.), client side technologies AngularJS, KnockoutJS, Javascript, Ajax Calls, Json and Hybrid apps etc. I love to devote free time in writing, blogging, social networking and adventurous life

Post A Comment:


  1. I have gateway uc100, i want connect to send sms in c#. Can you help me?

    1. yes, can you send your all required information senderURL, username, password etc. to my emailID if are you still facing problem.

  2. Please use this Document & help to create in c# with SMSGATEWAYHUB

  3. SMS services like bulk sms, transaction sms, promotional sms, SMS API, OTP, QTP, are great strategy to work with huge number of clients. It helps in maintain a good relation with clients. you can select Top 5 Bulk SMS Service Provider in India with SMS API for your business.

    1. how should i implement this module in my project using c#

  4. Great article Anjan I personally use for promoting my business which has its API available for free and have a detailed explanation how to use their API to integrate to a website or a app.

    1. sir can you help to implement this module in my project

    2. yes, I can help you where are you getting problem. can you detail your problem here.

  5. hi Anjan Kant,
    Can this piece of code work for any sms geteway
    (I have requirement where I don't want to restrict my client to use only fixed sms gateway, means he can plug any sms gateway as his choice.) what to do?

    sushil bhat

    1. It may be few variations from SMS provider to provider but in this code added standard part of SMS code. In India, we need also to include template ID (standard text from TRAI authorised).

  6. Hey Anjan, thanks for writing this. Do you know what I was looking for some solution to send bulk SMS from one of my C# application and I got the answer here. Keep posting and helping, once again thanks for sharing.

  7. This facility enables a company to send auto replies and even get the messages forwarded to the company's smm panel