Пример #1
0
        public bool TrySend(string[] phones, string content, out SmsBaoResultCode err)
        {
            ThrowHelper.ThrowNullArgument(phones, nameof(phones));
            ThrowHelper.ThrowNullOrEmptyArgument(content, nameof(content));

            ValidSendConfig();

            // 调用 api
            using (var wc = new WebClient())
            {
                wc.Encoding = Encoding.UTF8;
                var api = CreateSendApiUrl(phones, content);
                var result = wc.DownloadString(api);

                err = result.To<SmsBaoResultCode?>() ?? SmsBaoResultCode.UnkownResult;
                return err == SmsBaoResultCode.NoError;
            }
        }
Пример #2
0
 public bool TrySend(string phone, string content, out SmsBaoResultCode err)
 {
     ThrowHelper.ThrowNullArgument(phone, nameof(phone));
     return TrySend(new string[] { phone }, content, out err);
 }