腾讯云接口发送短信
(1)创建签名

(2)创建模板

 可以自定义模板参数例如:你好{1},这是一个短信
(3)确认套餐包
发送的额度
(4)创建应用

查看应用设置:调用腾讯云接口时需要验证APPID。APPKEY是密码。
(5)引入sdk(软件开发工具包)
<dependency>
    <groupId>com.github.qcloudsms</groupId>
    <artifactId>qcloudsms</artifactId>
    <version>1.0.6</version>
</dependency>
(6)创建实体类
/**
 * 需要参数、收短信的手机号
 */
@Data
public class Sms {
    String phonenum;
    String xxx;
}
(7)发送短信
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
import com.qcby.xmdemo.model.Sms;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/sms")
public class SmsController {
    /**
     * appID appkey申请的应用相关信息
     * templeID模板id sigin签名
     * @param sms
     */
    @PostMapping("/send")
    public void sms(@RequestBody Sms sms){
        int appID=1400928529;
        String appkey="";
        int templeID=45662222;
        String sigin="";
        try {
            //获取定义的短信参数
            String[] param={sms.getPhonenum(),sms.getXxx()};
            SmsSingleSender smsSingleSender=new SmsSingleSender(appID,appkey);
            SmsSingleSenderResult result=smsSingleSender.sendWithParam("86",sms.getPhonenum(),templeID,param,
                    sigin,"","");
            //参数:中国区号,手机号,模板id,参数列表,签名
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}



















