سؤال

I am building my c# application that will notify the user through their mobile phone if they have registered successfully. This will send them their account details. I have successfully sent a message on my phone using Bulk SMS Clickatell using this code:

WebClient client = new WebClient();

baseURL = "http://api.clickatell.com/http/sendmsg?user=xxxxxx&password=xxxxxxx&api_id=xxxxxxxx&to='" + mobileNum + "'&text='" + msg + "'";

client.OpenRead(baseURL);

The problem is that I need to purchase some credits in order to send the actual message. The one I received on my mobile phone says that I need to buy credits etc etc.. Can someone suggest a way to send SMS messages without relying on a paid service?

هل كانت مفيدة؟

المحلول

You can try Twilio. It is free if you want to test, but after you have to pay.

They have a nice API with c# support.

// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account
        string AccountSid = "AC3094732a3c49700934481addd5ce1659";
        string AuthToken = "{{ auth_token }}";
        var twilio = new TwilioRestClient(AccountSid, AuthToken);
        var sms = twilio.SendSmsMessage("+15005550006", "+14108675309", "All in the game, yo", "");
        Console.WriteLine(sms.Sid);
    }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top