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("xxxxx");</pre>
Recommended tutorial:
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!