优化
This commit is contained in:
6
main.go
6
main.go
@@ -46,6 +46,7 @@ func main() {
|
||||
fmt.Printf("Fail to read file: %v", inierr)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
SEND_QQ := cfg.Section("global").Key("SEND_QQ").String()
|
||||
MAIL_KEY := cfg.Section("global").Key("MAIL_KEY").String()
|
||||
SMTP_SERVER := cfg.Section("global").Key("SMTP_SERVER").String()
|
||||
@@ -77,8 +78,11 @@ func main() {
|
||||
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 {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user