How to send sms
I want to send an sms to a mobile phone through my C#, C++ code. Can any开发者_StackOverflow社区 body help me. I dont want any mobile, or any external device attached to my computer. I am just having my laptop, or desktop PC and in that i want to write a C++ or C# application which can send an sms to a mobile phone.
Clickatell is a popular SMS gateway, which covers 819 networks in over 220 countries.
The API offers a choice of connection options via: HTTP/S, SMPP, SMTP, FTP, XML, SOAP and COM. You can simply choose any suitable connection method that you feel confortable using in C# or C++.
To give a few examples, the HTTP method would be as simple as requesting the following URI from your application:
http://api.clickatell.com/http/sendmsg?to=NUMBER&msg=Message+Body+Here
The SMTP method would consist in sending a plain-text email to sms@messaging.clickatell.com
, with a body as in the following example:
user: xxxxx
password: xxxxx
api_id: xxxxx
to: NUMBER
text: Message Body Here
The other methods are similarly easy to interface with, in my opinion. You can check out the full details from the Clickatell API Guide.
There are a couple options out there. You could use a gateway like Twilio, Clickatell or the many others. These cost money but are more reliable than other methods. I wrote a C#/.NET library for Twilio that makes it super easy to use.
Alternately you could ask each user for their carrier, then send an email to their phone's email address. This is less reliable and requires you to know what carrier they use and if they change carriers, they have to remember to tell you.
精彩评论