# aliyun-sms-go-sdk

阿里云短信官方无Go语言版SDK,本项目转载自 Github

使用前先获取SDK,部分地区可能需要代理

go get -u -v github.com/GiterLab/aliyun-sms-go-sdk

示例

package main

import (
	"fmt"
	"os"

	"github.com/GiterLab/aliyun-sms-go-sdk/dysms"
	"github.com/tobyzxj/uuid"
)
// modify it to yours
const (
	ACCESSID  = "your_accessid"
	ACCESSKEY = "your_accesskey"
)
func main() {
	dysms.HTTPDebugEnable = true
	dysms.SetACLClient(ACCESSID, ACCESSKEY) // dysms.New(ACCESSID, ACCESSKEY)

	// send to one person
	respSendSms, err := dysms.SendSms(uuid.New(), "1375821****", "多协云", "SMS_22175101", `{"company":"duoxieyun"}`).DoActionWithException()
	if err != nil {
		fmt.Println("send sms failed", err, respSendSms.Error())
		os.Exit(0)
	}
	fmt.Println("send sms succeed", respSendSms.GetRequestID())
}

短信模板中的变量使用json格式