How to Send SMS with C#

C# (C sharp) is one of the widely used programming languages. It combines principles from C and C++, C# is a general-purpose language used to develop software for Windows and Microsoft platforms.

You can now send bulk SMS via your C# application with the aid of the sample code below.

View more available features and configurations on Custom API page.

Download C# Demo Files

Sample code

You can compose multiple forms of messages, e.g. VCard, Flash SMS, calendars, ringtones and so forth by using C#.

using System.IO;

namespace WindowsFormsApplication1
{
public partial class sendMsg : Form
{

public sendMsg()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
this.txtUser.Select();
}

private void btnSend_Click(object sender, EventArgs e)
{

// Create a new 'Uri' object with the specified string.
Uri myUri = new Uri("http://isms.com.my/isms_send.php?un=" + txtUser.Text + "&pwd=" + txtPass.Text + "&dstno=" + txtDstNo.Text + "&msg=" + txtMsgBox.Text + "&type=1&sendid=\"isms\"");

// Create a new request to the above mentioned URL.
WebRequest myWebRequest = WebRequest.Create(myUri);
Assign the response object of 'WebRequest' to a 'WebResponse' variable.
WebResponse myWebResponse = myWebRequest.GetResponse();
StreamReader reader = new StreamReader(myWebResponse.GetResponseStream());

string s_ResponseString = reader.ReadToEnd();
msgsent show = new msgsent();
show.ShowDialog();

}
}
}
        

After making compilation for the C# scripts,a window will be prompted. Key in username and password of your iSMS account, followed by destination number (Recipient's mobile number).

Draft your message and Click "Send".

Bulk SMS with C#

A message will be prompted to notify you that the message is delivered. Click "OK" to dismiss the dialog box.

Bulk SMS with C#