Home > Java > JavaBase > body text

How to implement the function of sending text messages in java

王林
Release: 2019-11-20 10:01:25
Original
3991 people have browsed it

How to implement the function of sending text messages in java

1. Add a signature in Alibaba Cloud SMS Service

2. Add a template in Alibaba Cloud SMS Service

3. Create your own AccessKey ID and Access Key Secret

4. You need to download two jar packages

aliyun-java-sdk-core-3.3.1.jar
aliyun-java-sdk-dysmsapi-1.0.0.jar
Copy after login

5. Then create a new Sendmss class (four modifications are required Place)

①: This needs to be replaced with the developer’s own AK (find it in the Alibaba Cloud access console)

static final String accessKeyId = "xxxxxxxxxx";
Copy after login

②: SMS signature - can be found in the SMS console ​​ ​ ​ ​ ​ ​", the value here is ​​​

request.setTemplateParam("{ \"code\":\"" yzm "\"}");

static final String accessKeySecret ="xxxxxxxxxxxxxxxxxxxx";
Copy after login

New test class

request.setSignName("xxxxx");
Copy after login
Recommended tutorial: Getting started with java development

The above is the detailed content of How to implement the function of sending text messages in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!