public static SMSMessage BuildMessageFromNotification(QueuedNotification notification)
 {
     SMSMessage message = null;
     if (notification != null)
     {
         message = new SMSMessage
         {
             Body = notification.Message,
             Recipient = notification.RecipientAddress
         };
     }
     return message;
 }
Пример #2
0
 public string SendMessage(SMSMessage message)
 {
     Uri address = new Uri("http://smsc.xwireless.net/API/WebSMS/Http/v2.0/", UriKind.Absolute);
     var data = new NameValueCollection();
     data.Add("method", "compose");
     data.Add("username", "xanosms.com");
     data.Add("password", "Udoji22");
     data.Add("sender", "Zakar");
     data.Add("to", message.Recipient);
     data.Add("message", message.Body);
     data.Add("international", "1");
     data.Add("format", "json");
     using (var client = new WebClient())
     {
         byte[] bytes = client.UploadValues(address, "POST", data);
         return new UTF8Encoding().GetString(bytes);
     }
 }