zoukankan      html  css  js  c++  java
  • 阿里云短信服务,阿里发送短信服务

    依赖
            <dependency>
                <groupId>com.aliyun</groupId>
                <artifactId>dysmsapi20170525</artifactId>
                <version>2.0.6</version>
            </dependency>
    package com.sensor.sellCabinet.util;
    import com.aliyun.tea.*;
    import com.aliyun.dysmsapi20170525.*;
    import com.aliyun.dysmsapi20170525.models.*;
    import com.aliyun.teaopenapi.*;
    import com.aliyun.teaopenapi.models.*;
    
    
    
    public class AliMsgUtil {
    
        /**
         * 使用AK&SK初始化账号Client
         * @param accessKeyId
         * @param accessKeySecret
         * @return Client
         * @throws Exception
         */
        public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
            Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 您的AccessKey Secret
                .setAccessKeySecret(accessKeySecret);
            // 访问的域名
            config.endpoint = "dysmsapi.aliyuncs.com";
            return new com.aliyun.dysmsapi20170525.Client(config);
        }
    
        public static void main(String[] args_) throws Exception {
            java.util.List<String> args = java.util.Arrays.asList(args_);
            com.aliyun.dysmsapi20170525.Client client = AliMsgUtil.createClient("xxxxxxxx", "xxxxxx");
            SendSmsRequest sendSmsRequest = new SendSmsRequest()
                .setPhoneNumbers("xxxxx")
                .setSignName("xxxx")
                .setTemplateCode("xxxxx")
                .setTemplateParam("{\"code\":\"123456\"}");
            // 复制代码运行请自行打印 API 的返回值
            SendSmsResponse sendSms = client.sendSms(sendSmsRequest);
    
        }
    }
  • 相关阅读:
    利用NPOI导出数据到Execl
    分享微信开发Html5轻游戏中的几个坑
    Integrate non-OSGi Dependencies
    Websocket Component
    ServiceMix in daemon mode
    springboot jwt配置(更新中)
    npm run build 后的dist文件,发布到web服务。
    不重复随机数列的生成算法 Leetcode 384. Shuffle an Array
    LSM树-HBASE为什么快
    混沌工程初探
  • 原文地址:https://www.cnblogs.com/qq376324789/p/15527283.html
Copyright © 2011-2022 走看看