Ver código fonte

fix:发送邮件方法新增发送邮件来源

Roc 3 anos atrás
pai
commit
d91efb64e1
2 arquivos alterados com 9 adições e 0 exclusões
  1. 1 0
      .gitignore
  2. 8 0
      utils/email.go

+ 1 - 0
.gitignore

@@ -3,3 +3,4 @@
 /hongze_edb_lib.exe
 /lastupdate.tmp
 /rdlucklog
+hongze_edb_lib

+ 8 - 0
utils/email.go

@@ -3,11 +3,19 @@ package utils
 import (
 	"fmt"
 	"gopkg.in/gomail.v2"
+	"runtime"
 	"strings"
 )
 
 //发送邮件
 func SendEmail(title, content string, touser string) bool {
+	emailSource := ``
+	pc, _, line, ok := runtime.Caller(1)
+	if ok{
+		emailSource = fmt.Sprint( runtime.FuncForPC(pc).Name(), ",第", line, "行:")
+	}
+	content = fmt.Sprint(emailSource,"\n",content)
+
 	if RunMode == "debug" {
 		FileLog.Info(fmt.Sprint(title, ";", content))
 		return false