コード例 #1
0
        public Task SendAsync(SendSMSOptions options)
        {
            var from = options.Subject != null ? new PhoneNumber(options.Subject) : dispatchContact;

            return(Task.WhenAll(options.Destinations.Select(x => MessageResource.CreateAsync(new CreateMessageOptions(new PhoneNumber(x))
            {
                Body = options.Message,
                From = from
            }))));
        }
コード例 #2
0
ファイル: MNotify.cs プロジェクト: Euler-KB/BusWork
 public async Task SendAsync(SendSMSOptions options)
 {
     using (var httpClient = new HttpClient())
     {
         foreach (var phone in options.Destinations)
         {
             string contentEncoded = HttpUtility.UrlEncode(options.Message);
             string msgSubject     = options.Subject ?? subject;
             string url            = $"{BaseUrl}?key={key}&to={phone}&msg={contentEncoded}&sender_id={msgSubject}";
             await httpClient.GetAsync(url);
         }
     }
 }
コード例 #3
0
 public Task SendAsync(SendSMSOptions options)
 {
     Debug.WriteLine($"Send '{options.Message}' from {options.Subject ?? "Unspecified"} to {string.Join(",", options.Destinations)} ");
     return(Task.FromResult(0));
 }