发送短信
更新时间:2021-07-05
发送短信
通过以下代码可以发送SMS消息:
contentMap := make(map[string]interface{})
contentMap["code"] = "123"
contentMap["minute"] = "1"
sendSmsArgs := &api.SendSmsArgs{
Mobile: "13800138000",
Template: "your template id",
SignatureId: "your signature id",
ContentVar: contentMap,
}
result, err := client.SendSms(sendSmsArgs)
if err != nil {
fmt.Printf("send sms error, %s", err)
return
}
fmt.Printf("send sms success. %s", result)
提示: 详细的参数配置及限制条件,可以参考SMS API详情短信下发