Reader Level:
ARTICLE

Send SMS Using C# .Net

Posted by Shivam Pandya Articles | Visual Studio October 08, 2012
Here you can send SMS using the way2sms client library from your very own C# .Net Web/Window Application
  • 2
  • 0
  • 133691

Here I'm showing you how to send SMS using your C# .Net Application. Please use the following instructions and you are ready to go within 8-10 minutes.

Here some requirements for this application:

  1. Active Internet connection
  2. Download the SMSClient DLL (Here
  3. Visual Studio 10 (Visual Studio 2010) or above (the SMSClient DLL works only in Visual Studio 10 or above)
  4. .Net 4.0 or above

Now here are some easy steps to follow.

  • Create a new C# Windows Application

Window-form-application-C-Sharp.jpg

  • Design your application page something like this:

SMS-Client-page-in-C-Sharp.jpg

  • Now add a reference for the SMS Client Dll, as in:

Projects -> Add reference -> Browse -> select your SMS client DLL

Add-Reference-page-in-C-Sharp.jpg

  • Now put the following code in your "Send" buttons Click Event

First of all add a "using" for the smsclient dll, as in:

using SmsClient;

Now use this code to send the sms and check the internet status and whether users exist.

SendSms sms = new SendSms();

string status = sms.send(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text);

if (status == "1")

{

MessageBox.Show("Message Send");

}

else if (status == "2")

{

MessageBox.Show("No Internet Connection");

}

else

{

MessageBox.Show("Invalid Login Or No Internet Connection");

}

  • Now run your application and enjoy
  • This application works as a charm, but it has some drawbacks which I described below:
  1. An active internet connection is required.
  2. The .Net 4.0 Framework is needed with Visual Studio 10
  3. The application works in India only because the Way2sms provides service in India only, but they say they will start services in other nations shortly, so after that we will be able to use this application for those nations too.

Article Extensions
Contents added by sathish j on Mar 22, 2013
I wrote the code as below in vb.net

Imports SmsClient

Public Class Form1 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim sample As New SendSms()
            Dim str As String = sample.send("XXXX", "XXXX", "Test from VS2010", "XXXXX")  
         'Here i've replaced my authentication details as X for security purpose

            If str = "1" Then
                MessageBox.Show("Message Send")
            ElseIf str = "2" Then
                MessageBox.Show("No Internet Connection")
            Else
                MessageBox.Show("Invalid Login Or No Internet Connection")
            End If
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        End Try
       

    End Sub
End Class


 When i run the application it will return no internet connection error. I've the active internet connection but in the proxy mode. ie., i've to give my authentication details inorder to connect internet. So how can i achieve this? do i mention any code to access through proxy server. Kindly check and revert.

Regards,
Sathish.J

Contents added by dhara patel on Mar 19, 2013

I have follow the same instruction as u given ...

bt still it returns the result status -11...
plz give me solution for it..
thanx in advance..

Contents added by websoft creation on Feb 06, 2013
Its not working.Its giving error status -1. I used this given code.I used right username and password.SO give me solution on yogeshdotnet@gmail.com
Contents added by bhaveshvirani virani on Jan 08, 2013
message send Message Display but Message Was not Receive
Contents added by Mahmoud sHAHIN on Dec 07, 2012
Contents added by bhumika raghawani on Dec 04, 2012
your code is not working properly.........
COMMENT USING

Trending up