//http://sendcloud.sohu.com func SendMailBySohu(to, subject, body string) (err error) { resp, err := http.PostForm(Config.GetUrl().MailApi, url.Values{"to": {to}, "subject": {subject}, "html": {body}}) if err != nil { return err } defer resp.Body.Close() res, err := ioutil.ReadAll(resp.Body) if err != nil { Utils.LogPanicErr(err) } Utils.LogInfo(string(res)) return nil }
func SendSms(mobile, body string) (err error) { url := fmt.Sprintf(Config.GetUrl().SmsApi, mobile, body) resp, err := http.Get(url) if err != nil { return err } defer resp.Body.Close() res, err := ioutil.ReadAll(resp.Body) if err != nil { return err } else { if string(res) == "0" { return nil } else { return errors.New(string(res)) } } return nil }