Exemple #1
0
func postMsg() {
	appId := "XXXX"
	appKey := "XXXXX"
	restapi := fmt.Sprint("http://*****:*****@v", v)
	}
}
Exemple #2
0
func main() {
	rp = utee.CreateRedisPool(30, "106.75.27.144:6379", "baulk3?speed")
	addr := flag.String("p", ":6666", "address where the server listen on")
	flag.Parse()
	log.Printf("start server http 1 on %s \n", *addr)
	guards := NewHealthGuards(*addr)
	for _, v := range guards.m {
		healthApi := v.(*HealthApi)
		if v.key == guards.keyMe {
			continue
		}
		uri := fmt.Sprint(healthApi.api, "/cache/clear/:id")
		utee.HttpPost(uri, &url.Values{})
	}
	http.HandleFunc("/api/health", guards.healthCheckHandler)
	log.Fatal(http.ListenAndServe(*addr, nil))

}
func main() {
	address := "http://sendcloud.sohu.com/webapi/mail.send.json"
	apiUser := "******"
	apiKey := "3p03OLGHQ1W4cCnv"

	q := url.Values{}
	q.Add("api_user", apiUser)
	q.Add("api_key", apiKey)

	q.Add("from", "*****@*****.**")
	q.Add("fromname", "SendCloud测试邮件")
	q.Add("to", "*****@*****.**")
	q.Add("subject", "FigoTest")
	q.Add("html", "你太 棒了!你已成功的从SendCloud发送了一封测试邮件,接下来快登录前台去完善账户信息吧!")
	q.Add("resp_email_id", "true")

	b, err := utee.HttpPost(address, q)
	if err != nil {
		fmt.Print("err:", err)
	}
	fmt.Print("@rsp:" + string(b))
}
Exemple #4
0
func main() {
	vendors := []string{"*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**"}
	type S struct {
		Link     []string `json:"{{.link}}"`
		Mail     []string `json:"{{.mail}}"`
		Platform []string `json:"{{.platform}}"`
		Version  []string `json:"{{.version}}"`
		Update   []string `json:"{{.update}}"`
	}
	type M struct {
		To  []string `json:"to"`
		Sub S        `json:"sub"`
	}

	param := url.Values{
		"api_user":             {API_EMAIL_USER},
		"api_key":              {API_EMAIL_KEY},
		"from":                 {API_EMAIL_FROM},
		"fromname":             {API_EMAIL_FROMNAME},
		"subject":              {API_EMAIL_SUBJECT},
		"template_invoke_name": {API_EMAIL_TEMPLATE_NAME},
	}

	to := make([]string, 0)
	link := make([]string, 0)
	mail := make([]string, 0)
	platform := make([]string, 0)
	version := make([]string, 0)
	update := make([]string, 0)
	for i := 0; i < len(vendors); i++ {
		to = append(to, vendors[i])
		link = append(link, "http://doc.mpush.cn/sdk/ios/")
		mail = append(mail, vendors[i])
		platform = append(platform, "ios")
		version = append(version, "1.9.1")
		update = append(update, "优化SDK整体性能修复发现的问题")
		if len(to) < 2 && i <= len(vendors) {
			continue
		}
		m := &M{
			To: to,
			Sub: S{
				Link:     link,
				Mail:     mail,
				Platform: platform,
				Version:  version,
				Update:   update,
			},
		}
		msg, e := json.Marshal(m)
		utee.Chk(e)
		param.Set("substitution_vars", string(msg))
		log.Println("param", param)
		a, err := utee.HttpPost(API_EMAIL_URL, param)
		log.Print("a...", string(a))
		if err != nil {
			log.Println("send mail err", err)
		}
		to = nil
		link = nil
		mail = nil
		platform = nil
		version = nil
		update = nil
	}
}