1 Star 0 Fork 40

leadsoft / aliyun-sms

forked from 永夜 / aliyun-sms 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
zhangpeng 提交于 2018-05-11 10:50 . update

License Maven Central Build Status Libraries.io for GitHub

aliyun-sms

阿里云 SMS 短信 Java SDK 封装

使用

  1. 添加依赖
<dependency>
    <groupId>cn.javaer.aliyun</groupId>
    <artifactId>aliyun-sms</artifactId>
    <version>1.1.0</version>
</dependency>
  1. 样例
SmsClient smsClient = new SmsClient(accessKeyId, accessKeySecret);
SmsTemplate smsTemplate = SmsTemplate.builder()
            .signName(signName)
            .templateCode(templateCode)
            .addTemplateParam("code", "123456")
            .phoneNumbers(phoneNumber)
            .build();
smsClient.send(smsTemplate);            

spring boot 集成

  1. 添加依赖
<dependency>
    <groupId>cn.javaer.aliyun</groupId>
    <artifactId>aliyun-spring-boot-starter-sms</artifactId>
    <version>1.1.0</version>
</dependency>
  1. 配置
aliyun.sms.accessKeyId=
aliyun.sms.accessKeySecret=
aliyun.sms.signName=
aliyun.sms.templates.key1.templateCode=
  1. 样例
    @Autowired
    private SmsClient smsClient;

官方文档:https://help.aliyun.com/document_detail/55284.html?spm=5176.8195934.1001856.3.5cd64183fNqodO

Java
1
https://gitee.com/leadsoft/aliyun-sms.git
git@gitee.com:leadsoft/aliyun-sms.git
leadsoft
aliyun-sms
aliyun-sms
master

搜索帮助