https://github.com/cn-src/aliyun-sms
阿里云 SMS 短信 Java SDK 封装
https://github.com/cn-src/aliyun-sms
aliyun sms springboot
Last synced: about 1 year ago
JSON representation
阿里云 SMS 短信 Java SDK 封装
- Host: GitHub
- URL: https://github.com/cn-src/aliyun-sms
- Owner: cn-src
- License: apache-2.0
- Created: 2018-02-07T07:38:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T07:00:35.000Z (about 7 years ago)
- Last Synced: 2025-04-13T14:54:08.624Z (about 1 year ago)
- Topics: aliyun, sms, springboot
- Language: Java
- Homepage:
- Size: 101 KB
- Stars: 81
- Watchers: 3
- Forks: 36
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://opensource.org/licenses/Apache-2.0)

[](https://travis-ci.org/cn-src/aliyun-sms)
# aliyun-sms
阿里云 SMS 短信 Java SDK 封装
Github & Issues: [https://github.com/cn-src/aliyun-sms](https://github.com/cn-src/aliyun-sms)
# 使用
1. 添加依赖
``` xml
cn.javaer.aliyun
aliyun-sms
1.2.0
```
2. 样例
```java
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. 添加依赖
``` xml
cn.javaer.aliyun
aliyun-spring-boot-starter-sms
1.2.0
```
2. 配置
```
aliyun.sms.accessKeyId=
aliyun.sms.accessKeySecret=
aliyun.sms.signName=
aliyun.sms.templates.key1.templateCode=
```
3. 样例
```java
@Autowired
private SmsClient smsClient;
```
[官方文档:https://help.aliyun.com/document_detail/55284.html?spm=5176.8195934.1001856.3.5cd64183fNqodO](https://help.aliyun.com/document_detail/55284.html?spm=5176.8195934.1001856.3.5cd64183fNqodO)