Introduction
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.- First of all. We need to create an URL to send text message on mobile device.
- We require web or IP address with parameters like username, password, recipient, senderid, text message and response etc.
- Parameters can vary depend on SMS provider service. Providers provide complete information to send SMS.
- Now we need to create web request to send SMS using C# code.
- We can also track response after sending text message on mobile device.
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; try { // 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(); _responseStreamReader.Close(); myResp.Close(); } catch { // } return View(); }
I have gateway uc100, i want connect to send sms in c#. Can you help me?
ReplyDeleteyes, can you send your all required information senderURL, username, password etc. to my emailID kantanjan@gmail.com if are you still facing problem.
DeletePlease use this Document & help to create in c# with SMSGATEWAYHUB
ReplyDeletehttps://www.smsgatewayhub.com/Panel/WebAPI/HTTP%20API%203.0.1%20-%20SMSGATEWAYUHB.pdf
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.
ReplyDeletehow should i implement this module in my project using c#
DeleteGreat article Anjan I personally use www.textlocal.in 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.
ReplyDeletesir can you help to implement this module in my project
Deletesir can u help me
Deleteyes, I can help you where are you getting problem. can you detail your problem here.
Deletehi Anjan Kant,
ReplyDeleteCan 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?
thanks
sushil bhat
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).
DeleteHey 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.
ReplyDeletehi, i want send email to gmail and sms to registration mobile number who is already registered. Using with mvs 5 3 tier architecture can you help me?
ReplyDeleteyes, this code will work for you using MVC as well :)
DeleteUsing this code , I am not able to send SMS
ReplyDeletewhat issue are you facing?
Delete