-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsimple.cs
More file actions
35 lines (29 loc) · 1 KB
/
simple.cs
File metadata and controls
35 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Simple example sending a text message via the websms.com services.
using System;
using Websms;
class Test
{
static void Main()
{
// Create the client.
SmsClient client = new SmsClient("username", "password", "https://api.websms.com/json");
// Create new message with one recipient.
TextMessage textMessage = new TextMessage(4367612345678, "Hello World!");
try
{
// If test = true, it's just a test. No real sms will be sent.
bool test = false;
// Send the message.
MessageResponse response = client.Send(textMessage, 1, test);
// Print the response.
Console.WriteLine("Status message: " + response.statusMessage);
Console.WriteLine("Status code: " + response.statusCode);
}
catch (Exception ex)
{
// Handle exceptions.
Console.WriteLine(ex.Message);
}
Console.ReadKey();
}
}