Home  >  Article  >  Java  >  How to implement the function of sending text messages in java

How to implement the function of sending text messages in java

王林
王林Original
2019-11-20 10:01:254032browse

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

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";

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

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

static final String accessKeySecret ="xxxxxxxxxxxxxxxxxxxx";

New test class <pre class="brush:php;toolbar:false">request.setSignName(&quot;xxxxx&quot;);</pre> 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!

Statement:
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