|
@@ -73,6 +73,31 @@ func GSendMail(from, to, cc, bcc, subject, body, fname, rename string, auth *Gma
|
|
return gSend(reTry, auth, m, to)
|
|
return gSend(reTry, auth, m, to)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 电销 多人
|
|
|
|
+func GSendMail_dx(from, to, cc, bcc, subject, body, fname, rename string, auth *GmailAuth) bool {
|
|
|
|
+ m := gomail.NewMessage()
|
|
|
|
+ m.SetAddressHeader("From", auth.User, from) // 发件人
|
|
|
|
+ m.SetHeader("To", strings.Split(to, ",")...) // 收件人
|
|
|
|
+ if cc != "" {
|
|
|
|
+ m.SetHeader("Cc", strings.Split(cc, ",")...) //抄送
|
|
|
|
+ }
|
|
|
|
+ if bcc != "" {
|
|
|
|
+ m.SetHeader("Bcc", m.FormatAddress(bcc, "收件人")) // 暗送
|
|
|
|
+ }
|
|
|
|
+ m.SetHeader("Subject", subject) // 主题
|
|
|
|
+ m.SetBody("text/html", body) // 正文
|
|
|
|
+ if fname != "" {
|
|
|
|
+ h := map[string][]string{"Content-Type": {"text/plain; charset=UTF-8"}}
|
|
|
|
+ m.Attach(fname, gomail.Rename(rename), gomail.SetHeader(h)) //添加附件
|
|
|
|
+ //m.Attach(fname) //添加附件
|
|
|
|
+ }
|
|
|
|
+ reTry := auth.ReTry
|
|
|
|
+ if reTry == 0 {
|
|
|
|
+ reTry = 3
|
|
|
|
+ }
|
|
|
|
+ return gSend(reTry, auth, m, to)
|
|
|
|
+}
|
|
|
|
+
|
|
// 如果附件是byte,用这个
|
|
// 如果附件是byte,用这个
|
|
func GSendMail_B(from, to, cc, bcc, subject, body, fname string, fb []byte, auth *GmailAuth) bool {
|
|
func GSendMail_B(from, to, cc, bcc, subject, body, fname string, fb []byte, auth *GmailAuth) bool {
|
|
m := gomail.NewMessage()
|
|
m := gomail.NewMessage()
|