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 })))); }
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); } } }
public Task SendAsync(SendSMSOptions options) { Debug.WriteLine($"Send '{options.Message}' from {options.Subject ?? "Unspecified"} to {string.Join(",", options.Destinations)} "); return(Task.FromResult(0)); }