package main

import (
	"fmt"
	"io/ioutil"
	"os"
	qu "qfw/util"
	"qfw/util/mail"
)

var from,to,cc, smtpHost,user,pwd string
var smtpPort int


func sendErrMailSmtp(title,body string) {


	smtpMail, _ := sysconfig["smtpMail"].(map[string]interface{})

	if smtpMail != nil {
		from, _ = smtpMail["from"].(string)
		to, _ = smtpMail["to"].(string)
		cc, _ = smtpMail["cc"].(string)
		smtpHost, _ = smtpMail["smtpHost"].(string)
		smtpPort= qu.IntAll(smtpMail["smtpPort"])
		user, _ = smtpMail["user"].(string)
		pwd, _ = smtpMail["pwd"].(string)
	}
	f, _ := os.Open(xlsx_name)
	b, err := ioutil.ReadAll(f)
	if err != nil {
		fmt.Println("err:",err)
		return
	}

	ok := mail.GSendMail_B(user, from, cc, from, title, body, f.Name(), b, &mail.GmailAuth{
		SmtpHost: smtpHost,
		SmtpPort: smtpPort,
		User:     user,
		Pwd:      pwd,
	})
	fmt.Println(ok)
}