Ozeki's C# sms api provides feedback in the form of events. This is great because other SMS api-s don't offer delivered to handset reports or any other real feedback about what happened to your SMS. Here is the code.
using System;
using OZX;
namespace OzekiConsoleClient
{
class Program
{
static OzxClient Client;
static void Main(string[] args)
{
Client = new OzxClient();
Client.AutoReconnect = true;
Client.OnMessageAcceptedForDelivery += Client_OnMessageAcceptedForDelivery;
Client.OnMessageNotAcceptedForDelivery += Client_OnMessageNotAcceptedForDelivery;
Client.OnMessageSubmitSuccess += Client_OnMessageSubmitSuccess;
Client.OnMessageSubmitFailed += Client_OnMessageSubmitFailed;
Client.OnMessageDeliverySuccess += Client_OnMessageDeliverySuccess;
Client.OnMessageDeliveryFailed += Client_OnMessageDeliveryFailed;
Client.OnMessageViewed += Client_OnMessageViewed;
Client.OnConnected += Client_OnConnected;
Client.OnDisconnected += Client_OnDisconnected;
Client.Connect("127.0.0.1",9580,"testuser","testpass");
}
static void Client_OnConnected(object sender, EventArgs e)
{
Console.WriteLine("Successfully connected.");
var msg = new OzxMessage();
msg.ToAddress = "+447958448798";
msg.Text = "Hello world";
Console.WriteLine("Sending message. ID: "+msg.ID);
Client.Send(msg);
}
}
}
You can also use this code to send an SMS through an Android Mobile instead of subscribing for an On-line SMS service.
Disclaimer: I work for Ozeki.