编程知识 cdmana.com

Super simple java SMS verification code, God level work

Alibaba cloud SMS use -- Pay Extension Education  

SMS cat : The so-called SMS cat , It's actually a device for sending and receiving messages , He's the same cell phone we use , Mobile phone required SIM Card support , When you need to send and receive messages , Insert a mobile phone card we usually use in the SMS cat , Plug in the power supply , adopt (USB Or serial port 、 so ) The data line is connected to the computer , In the application management software of computer, the function of sending and receiving SMS can be realized .

Cooperate with other third-party SMS platforms , For example, Alibaba cloud SMS .

  Chapter two : Alibaba cloud SMS service

    1. 1. Alibaba cloud SMS service application

Baidu alicloud , Enter official website .https://www.aliyun.com. After access, you need to sign in , The existing account can be logged in directly .( You can also log in using Alipay account )

Choose products , Enter the SMS service

Click management console , Enter SMS Management page

Click domestic news , Apply for signature

Click Template Management , Apply for SMS template

Enter the user management page , Get permission to visit Alibaba cloud api The secret key to ( The secret key is to keep secret )

Get the secret key

Last but not least, don't forget to charge money 、 Recharge 、 Recharge .

2. Alibaba cloud SMS entry code

Click Help documentation , Check out the specific development help . Can download sdk and Java Of demo Program ( Very important , The code doesn't have to be written by yourself )

Send SMS code

​ Import developed 2 individual jar package (aliyun-java-sdk-core-3.2.5.jar and aliyun-java-sdk-dysmsapi-1.0.0-SNAPSHOT.jar)

  Use the downloaded demo Case study , Finish sending SMS

package cn.tx.demo;
​
import cn.tx.utils.RandomCode;
import cn.tx.utils.SmsUtils;
import com.aliyuncs.exceptions.ClientException;
​
/**
 *  Send SMS entry program 
 */
public class Demo1 {
​
    public static void main(String[] args) {
        //  Generate verification code randomly 
        String code = RandomCode.genCode();
        System.out.println(" Verification Code :"+code);
 try {
            //  Send SMS 
            SmsUtils.sendSms(" cell-phone number ", code);
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }
}

 

  1. The third chapter : SMS project practice
    1. 1. User registration function project practice

The running teacher provides good code , Complete registration function .

 

Based on my many years of working experience and learning experience , Recorded a new set of Java Focus on video tutorials , If you are learning now Java, At the beginning of learning Java There is no systematic learning course in the process , You can add groups 654631948 Collect the learning materials , Interview questions , Development tools, etc , There are senior people in the group java The teacher answers questions , Every day, there will also be live lectures on the basic part and architecture , You can also add my wechat renlliang2013 In depth communication , As long as I really want to learn Java People welcome .

java Basic course :https://ke.qq.com/course/149432?tuin=57912c43


Java Distributed Internet Architecture / Microservices / High performance /springboot/springcloud:

https://ke.qq.com/course/179440?tuin=57912c43

版权声明
本文为[renlianggee]所创,转载请带上原文链接,感谢

Scroll to Top