Tuesday, April 17, 2012

Sen bulk SMS via C# using Way2Sms / 160by2 accounts and more

In the previous post we can send single sms. But now it was updated to bulk sms and sms can be repeated.

as shown in the figure. and supports all the providers shown in the image.





using SMSClassLibrary;  // namespace

// class name

ReddyInfoSoft ris = new ReddyInfoSoft();
            string res = ris.sendSMS("account id","pwd","sample SMS text","to no","provider","1");

Note :-  Please use (coma) "," to send bulk SMS

Ex: :-  9849996598,9999999999,8047845698

 1 = SMS sent
-1 = Server Error
-2 = Invalid Username
-3 = Invalid message text
-4 = Login Failed
-5 = IP Blocked
-11 – Unsupported Provider  (Since March 1 2013)

Download Bulk SMS Library

73 comments:

  1. hi can you please share the c# code

    ReplyDelete
  2. is this method is safe are not capturing id and password

    ReplyDelete
  3. plz send me the code for sending sms using way2sms.com
    my email id is: anil.wanare75@gmail.com

    ReplyDelete
  4. Hello Raghavendra you can trust me. It's a safe code. and moreover if you feel in such a way don't use this code...

    ReplyDelete
    Replies
    1. sir will you please share this code on anjng028@gmail.com

      Delete
  5. Hello anil you can add the dll file provided in this post as a reference to send messages....

    ReplyDelete
  6. hi, can u plz send me the c# code of "SMSClassLibrary" plz plz i want that code for my project.
    my mail id is "tarun.bjt@gmail.com"
    Thank you :-)

    ReplyDelete
  7. I tried using it but Its not working

    ReddyInfoSoft ris = new ReddyInfoSoft();
    string res = ris.sendSMS("aaaaaa", "aaaaa", "sample SMS text", "nos", "Airtel", "1");
    Response.Write(res);

    and response i get is

    0 ( 2 members)

    ReplyDelete
  8. Hi Amit verma you should not give Airtel as a provider.
    Instead, You can use :-

    way2sms
    160by2
    fullonsms
    site2sms........

    Above providers are the websites API integrated...

    1 means SMS sent,
    -1 means some server error,
    -2 means invalid username,
    -3 means invalid message text,
    -4 means login failed.

    ReplyDelete
    Replies
    1. is there any unique key for way2sms or i just pass as a string 'way2sms'?

      Delete
    2. ReddyInfoSoft ris = new ReddyInfoSoft();
      string res = ris.sendSMS(uid, pswd, msg, mobile, "160by2", "1");

      Delete
  9. Good work. Can you please share logic if you dont mind for learning purpose (gmpat4u@gmail.com)

    I am thinking to make an Android app.

    Thanks in advance...

    ReplyDelete
  10. Hi can you share code of the same on kalubarmea@gmail.com

    ReplyDelete
  11. when i use it in a windows application, it works great but when I use it in a web application if gives me an exception. any clue?

    The type initializer for '' threw an exception. System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at .Initialize() at .cctor() The action that failed was: LinkDemand The type of the first permission that failed was: System.Security.Permissions.SecurityPermission The Zone of the assembly that failed was: MyComputer

    ReplyDelete
  12. Hi Ashwin Still now i didnt checked in a web application. Let me check it and i will give reply asap.

    ReplyDelete
  13. Hi Ashwin In the web site it is working perfectly.

    ReplyDelete
  14. plz help me with the c# code...i made the form and all...but i cant add the library to my projct.... rkaysha15@gmail.com

    ReplyDelete
  15. Hi Kaysha R, Let me know the procedure u followeb and what is the ERROR u got?

    ReplyDelete
  16. Hello guys

    When i run this dll in my web application then following Exception is coming up..

    AccessviolationException was unhanded..
    i am not sure what happening ..
    please give me any idea..

    ReplyDelete
  17. hi guys. this dll was great but i want one think that we send sms via way2sms we received our phone as Way2sms:********** * means my number. how i send my name as a sender.any ideas brother

    ReplyDelete
  18. How can i use this dll in my asp.net pages ,
    plz give me complete example on this

    ReplyDelete
  19. Hi ANIL BABU Mandla add this dll in your asp.net bin folder and use

    using SMSClassLibrary; // namespace

    and now you can use this class in any meathod in that page

    ReddyInfoSoft ris = new ReddyInfoSoft();
    string res = ris.sendSMS("account id","pwd","sample SMS text","to no","provider","1");

    ReplyDelete
  20. hi varaprasad,
    We tried to register SMSClassLibrary.dll with gac or regsvr32 to use this dll in other my application. but its giving the error as dll was not registered with strong name. so could you please provide us a registered dll with strong key name or complete code to my mail id: prasad.maganti@live.com

    ReplyDelete
    Replies
    1. no need to register SMSClassLibrary.dll , you jsut add as refference and call the method

      Delete
    2. add SMSClassLibrary.dll

      using SMSClassLibrary;

      ReddyInfoSoft ris = new ReddyInfoSoft();
      string res = ris.sendSMS("uid", "pwd", "Hello", "tono", "way2sms", "1");


      Delete
  21. Hi, its working fine but i can not send 2nd time to same number.
    please help

    ReplyDelete
    Replies
    1. Hi Milan Billara thanks for your reply. There wont be any problem to send 2nd time for the same No. Let me know any error U got.

      Delete
  22. hey plz mail me the source code @ shreyash.ssn@gmail.com...

    ReplyDelete
  23. hi, can u plz send me the c# code of "SMSClassLibrary" .
    my mail id is "goudas42@gmail.com"
    Thank you :-)

    ReplyDelete
  24. hi plz send c# code..when i trying to compile,it gives

    Error 1 The type or namespace name 'SMSClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

    plz send me soon guys...

    ReplyDelete
  25. hi...
    i got o/p like
    sending failed(exception)
    wat ill b reason 4 tis?

    ReplyDelete
    Replies
    1. Hi kalai arasan, when i tested now it was working fine...
      Let me know some more details..

      Delete
    2. sent 2 times with way2sms i i got sms

      Delete
    3. hi kalai arasan, try to use try block ... it works fine when you use a try block

      Delete
  26. This comment has been removed by the author.

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. cheers man !!
    i got it ... its working fine ... thanks a million

    ReplyDelete
  29. Hi,varaprasadreddy...Cheers for ur dll....its working splendid...Can you pls share the C# code with me so that I could use it in my web application...
    My email id is anooppg@indus-systems.com
    Thanks in advance

    ReplyDelete
  30. Hi,varaprasadreddy...Cheers for ur dll....its working splendid...Can you pls share the C# code with me so that I could use it in my web application...
    My email id is anooppg@indus-systems.com
    Thanks in advance

    ReplyDelete
  31. can u please share the code javadhafiz@gmail.com

    ReplyDelete
  32. can u please share code hetal.h.jariwala@gmail.com

    ReplyDelete
  33. @Vishal Srinivas- please send me source code on rushikesh1313@gmail.com

    ReplyDelete
  34. i am getting an error as 0(0 members)...plz help me..

    ReplyDelete
  35. Hi,varaprasadreddy.

    try
    {
    ReddyInfoSoft ris = new ReddyInfoSoft();
    string res = ris.sendSMS(tb_id.Text, tb_pass.Text, tb_msg.Text, tb_to.Text, "160by2", "1");

    }
    catch(Exception ex)
    {
    MessageBox.Show(ex.ToString());

    }

    this is my code , it is mot working

    ReplyDelete
    Replies
    1. hi the way U mentioned as string is correct....

      Delete
    2. Hai sir i have written the code as mentioned below

      namespace WindowsFormsApplication1
      {
      public partial class Form1 : Form
      {
      public Form1()
      {
      InitializeComponent();
      }

      private void button1_Click(object sender, EventArgs e)
      {
      //string Provider = "site2sms";
      string accountID = uid.Text;
      string password = pwd.Text;
      string SMStext = msg.Text;
      string to = phone.Text;
      ReddyInfoSoft ris = new ReddyInfoSoft();
      string result = ris.sendSMS("accountID", "password", "SMStext", "to", "site2sms");
      }
      }
      }

      but there is an error and the error is

      A call to PInvoke function 'SMSClassLibrary!InitializeDelegate::Invoke' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

      can u plz hele me with this error.
      i'm using this for my project in my college so its important plz....
      Thanks in advance

      Delete
  36. your proj is not working plz send me updated project
    on akashchopda555@gmail.com

    ReplyDelete
  37. Its Not Working Plz Help My Mail is mukeshbjp@gmail.com

    ReplyDelete
  38. Hi Vara Reddy, I tried your code for both i.e. way2sms as well as 160by2 but i am not able to send. the error it gives is -1. May i know the solution for it pls. Thanks in advance.

    ReplyDelete
  39. hi friend this project is one of the module in my project...
    so can u send me the code for this one ,its very useful for me pls brother by manimaran my email sullan.mp@gmail.com

    ReplyDelete
  40. i tried for way2sms and 160by2, returned 1 for only 160by2, but sms not recieved.

    ReplyDelete
  41. tried but getting -1(0 member)

    ReplyDelete
  42. this is returning status = sending failed(exception)

    ReplyDelete
  43. hi I am getting sending failed(exception ) error everytime
    pls help

    ReplyDelete
  44. Please share your code at tarun.usit@gmail.com if possible
    Thanks

    ReplyDelete
  45. Please tell me where should I have SMSClassLibrary.dll

    ReplyDelete
  46. sir
    I am interested in programming... on myself developed vb.net project for office purpose... and now need to send sms code integration with my project...
    please send me the code to mail id
    hi8880@gmail.com
    please sir

    ReplyDelete
  47. ReddyInfoSoft ris = new ReddyInfoSoft();
    string res = ris.sendSMS("jay","password","Hello" ,"1234567890", "indyarocks", "1");

    if (res == "1")
    {

    MessageBox.Show("Message Send");

    }

    else if (res == "-1")
    {

    MessageBox.Show("Server Error");

    }

    else if (res == "-2")
    {

    MessageBox.Show("Invalid Username");

    }
    else if (res == "-3")
    {

    MessageBox.Show("Invalid Message text");

    }
    else if (res == "-4")
    {

    MessageBox.Show("Login Failed");

    }
    else if (res == "-5")
    {

    MessageBox.Show("IP Blocked");

    }
    else if(res=="-11")
    {

    MessageBox.Show("Unsupported Provider");

    }

    what is wrong with this code????can any one tell me plz???
    i can not able to receive messages....i have checked in way2sms and indyarocks as well

    ReplyDelete
  48. ReddyInfoSoft ris = new ReddyInfoSoft();
    string res = ris.sendSMS("jay","pass","Hello" ,"1234567890", "indyarocks", "1");

    if (res == "1")
    {

    MessageBox.Show("Message Send");

    }

    else if (res == "-1")
    {

    MessageBox.Show("Server Error");

    }

    else if (res == "-2")
    {

    MessageBox.Show("Invalid Username");

    }
    else if (res == "-3")
    {

    MessageBox.Show("Invalid Message text");

    }
    else if (res == "-4")
    {

    MessageBox.Show("Login Failed");

    }
    else if (res == "-5")
    {

    MessageBox.Show("IP Blocked");

    }
    else if(res=="-11")
    {

    MessageBox.Show("Unsupported Provider");

    }
    }

    what is wrong with this code??? I can not able to receive messages..i have tried from way2sms and indyarocks as well

    ReplyDelete
    Replies
    1. Hi Jay Desai U can't send sms from way2sms and 160by2 sorry for the inconvenience and for the delay....

      this post was not updated.....

      check other posts in this blog ...

      Delete
  49. res shows result "1". but message still not sent. what should it be.?

    ReplyDelete
  50. I used "Ultoo" as provider and two numbers seperated with comma (for bulk sms). Messagebox.Show(res); results in 1 (1 member). but could not receive message. what could be the problem.

    ReplyDelete
  51. sir will you please share this code on parisha.saxena@gmail.com

    ReplyDelete
  52. sir i m typin this code but its not working plz tell me what is the problem


    using SMSClassLibrary;

    namespace StoneInventoryManagement
    {
    public partial class CustomerList : Form
    {
    public CustomerList()
    {
    InitializeComponent();
    }

    private void btnCls_Click(object sender, EventArgs e)
    {
    this.Close();
    }

    private void btnSend_Click(object sender, EventArgs e)
    {
    try
    {
    string accountID = txtAccId.Text;
    string password = txtPswd.Text;
    string SMStext = txtMsg.Text;
    string to = txtMobNo.Text;
    string provider = cmbProvider.Text;
    string repeat = txtRepeatSMS.Text;
    ReddyInfoSoft ris = new ReddyInfoSoft();
    string res = ris.sendSMS(accountID, password, SMStext, to, provider, repeat);
    if (res == "1")
    {

    MessageBox.Show("Message Send");
    }
    else if (res == "-1")
    {
    MessageBox.Show("Server Error");
    }
    else if (res == "-2")
    {
    MessageBox.Show("Invalid Username");
    }
    else if (res == "-3")
    {
    MessageBox.Show("Invalid Message text");
    }
    else if (res == "-4")
    {
    MessageBox.Show("Login Failed");
    }
    else if (res == "-5")
    {
    MessageBox.Show("IP Blocked");
    }
    else if(res=="-11")
    {
    MessageBox.Show("Unsupported Provider");
    }

    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.ToString());

    }

    }
    }
    }

    ReplyDelete
  53. please send source code smsclasslibrary.dll
    my mail id is telaprolukesav13@gmail.com

    ReplyDelete
  54. I am getting sending failed(exception)..can you tell me why?can you send the source code to madhava@stellentsoft.com

    ReplyDelete
  55. Hi two days before it was working fine but now its sending response as sending failed(exception)

    Any idea.

    am using fullonsms

    ReplyDelete
  56. Your post is really good providing good information.. I liked it and enjoyed reading it. Keep sharing such important postsbulk voice sms in india

    ReplyDelete
  57. Still it is giving No Internet Connection or Invalid Login.

    Am using site2SMS/way2sms as provider,still no luck

    Any clue

    ReplyDelete
  58. res gives the result 'Sending Failed (Exception)'
    Also exception 'SMSClassLibrary!InitializeDelegate::Invoke' has unbalanced the stack.' is thrown

    ReplyDelete
  59. I would like to use the services of way2 Bulk sms please send me the code really this service make my company to market every where thanks for sharing the article...

    ReplyDelete