This commit is contained in:
2022-10-17 18:44:36 +08:00
parent 68196e0ff8
commit 93758759f9

View File

@@ -46,6 +46,7 @@ func main() {
fmt.Printf("Fail to read file: %v", inierr) fmt.Printf("Fail to read file: %v", inierr)
os.Exit(1) os.Exit(1)
} }
SEND_QQ := cfg.Section("global").Key("SEND_QQ").String() SEND_QQ := cfg.Section("global").Key("SEND_QQ").String()
MAIL_KEY := cfg.Section("global").Key("MAIL_KEY").String() MAIL_KEY := cfg.Section("global").Key("MAIL_KEY").String()
SMTP_SERVER := cfg.Section("global").Key("SMTP_SERVER").String() SMTP_SERVER := cfg.Section("global").Key("SMTP_SERVER").String()
@@ -77,8 +78,11 @@ func main() {
e.AttachFile(*is_Attac) e.AttachFile(*is_Attac)
} }
host_sign := strings.Index(SMTP_SERVER, ":")
SMTP_SERVER_Host := SMTP_SERVER[0:(len(SMTP_SERVER) - len(SMTP_SERVER[host_sign:]))]
//设置服务器相关的配置 //设置服务器相关的配置
err := e.Send(SMTP_SERVER, smtp.PlainAuth("", SEND_QQ, MAIL_KEY, "smtp.qq.com")) err := e.Send(SMTP_SERVER, smtp.PlainAuth("", SEND_QQ, MAIL_KEY, SMTP_SERVER_Host))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }