aliyun-sms
阿里云 SMS 短信 Java SDK 封装
Github & Issues: https://github.com/cn-src/aliyun-sms
使用
- 添加依赖
<dependency>
<groupId>cn.javaer.aliyun</groupId>
<artifactId>aliyun-sms</artifactId>
<version>1.2.0</version>
</dependency>
- 样例
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 集成
- 添加依赖
<dependency>
<groupId>cn.javaer.aliyun</groupId>
<artifactId>aliyun-spring-boot-starter-sms</artifactId>
<version>1.2.0</version>
</dependency>
- 配置
aliyun.sms.accessKeyId=
aliyun.sms.accessKeySecret=
aliyun.sms.signName=
aliyun.sms.templates.key1.templateCode=
- 样例
@Autowired
private SmsClient smsClient;
官方文档:https://help.aliyun.com/document_detail/55284.html?spm=5176.8195934.1001856.3.5cd64183fNqodO