Ejemplo n.º 1
0
        /// <summary>
        /// 发送验证码短信:指明由易盾生成验证码
        /// </summary>
        private static SendResponse SendOtp()
        {
            // 这是你的 国内验证码短信 业务的ID。可以登录易盾官网查看此业务ID。
            var businessId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
            // 这是你事先创建好的模板,且已通过审核。
            var templateId = "xxxxx";
            // 这是收信方号码。如,134开头的号码一般是中国移动的号码。
            var to = "xxxxxxxxxxx";

            // 此处假设目标模板内容里只有验证码一个变量,所以没有其它变量需要指定
            var variables = new Dictionary <string, string>();

            // 发国内短信时,不指定 Country Calling Code
            var paramDict = CreateSendParam(businessId, templateId, variables, to, null);

            var response = RequestUtils.PostForEntity <SendResponse>(URI_SEND_SMS, paramDict);

            Console.WriteLine("response: " + response);

            return(response);
        }
Ejemplo n.º 2
0
 private static SendResponse Send(IDictionary <string, string> paramDict)
 {
     return(RequestUtils.PostForEntity <SendResponse>(URI_SEND_SMS, paramDict));
 }