From 13d48741c0d9a90483820e12c9eeda4b41aed63e Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Tue, 8 Sep 2020 17:00:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9email=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config.yaml | 2 +- server/utils/email.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/config.yaml b/server/config.yaml index c03b1eab..3b3f775e 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -11,7 +11,7 @@ jwt: # mysql connect configuration mysql: username: root - password: 'root' + password: 'Aa@6447985' path: '127.0.0.1:3306' db-name: 'qmPlus' config: 'charset=utf8mb4&parseTime=True&loc=Local' diff --git a/server/utils/email.go b/server/utils/email.go index 7e87383a..3a0e724b 100644 --- a/server/utils/email.go +++ b/server/utils/email.go @@ -1,10 +1,10 @@ package utils import ( + "crypto/tls" "fmt" - "strings" "net/smtp" - "crypto/tls" + "strings" "gin-vue-admin/global" @@ -31,9 +31,9 @@ func send(to []string, subject string, body string) error { auth := smtp.PlainAuth("", from, secret, host) e := email.NewEmail() - if nickName == "" { + if nickName != "" { e.From = fmt.Sprintf("%s <%s>", nickName, from) - }else{ + } else { e.From = from } e.To = to @@ -43,8 +43,8 @@ func send(to []string, subject string, body string) error { hostAddr := fmt.Sprintf("%s:%d", host, port) if isSSL { err = e.SendWithTLS(hostAddr, auth, &tls.Config{ServerName: host}) - }else{ + } else { err = e.Send(hostAddr, auth) } return err -} \ No newline at end of file +} -- GitLab