优化配置文件的结构体,优化文件上传与下载功能,系统配置的前端展示更友好及其他的优化
This commit is contained in:
@@ -12,13 +12,13 @@ import (
|
||||
)
|
||||
|
||||
func Email(subject string, body string) error {
|
||||
to := strings.Split(global.GVA_CONFIG.Email.EmailTo, ",")
|
||||
to := strings.Split(global.GVA_CONFIG.Email.To, ",")
|
||||
return send(to, subject, body)
|
||||
}
|
||||
|
||||
// ErrorToEmail Error 发送邮件
|
||||
func ErrorToEmail(subject string, body string) error {
|
||||
to := strings.Split(global.GVA_CONFIG.Email.EmailTo, ",")
|
||||
to := strings.Split(global.GVA_CONFIG.Email.To, ",")
|
||||
if to[len(to)-1] == "" { // 判断切片的最后一个元素是否为空,为空则移除
|
||||
to = to[:len(to)-1]
|
||||
}
|
||||
@@ -26,17 +26,17 @@ func ErrorToEmail(subject string, body string) error {
|
||||
}
|
||||
|
||||
func EmailTest(subject string, body string) error {
|
||||
to := []string{global.GVA_CONFIG.Email.EmailFrom}
|
||||
to := []string{global.GVA_CONFIG.Email.From}
|
||||
return send(to, subject, body)
|
||||
}
|
||||
|
||||
func send(to []string, subject string, body string) error {
|
||||
from := global.GVA_CONFIG.Email.EmailFrom
|
||||
nickname := global.GVA_CONFIG.Email.EmailNickname
|
||||
secret := global.GVA_CONFIG.Email.EmailSecret
|
||||
host := global.GVA_CONFIG.Email.EmailHost
|
||||
port := global.GVA_CONFIG.Email.EmailPort
|
||||
isSSL := global.GVA_CONFIG.Email.EmailIsSSL
|
||||
from := global.GVA_CONFIG.Email.From
|
||||
nickname := global.GVA_CONFIG.Email.Nickname
|
||||
secret := global.GVA_CONFIG.Email.Secret
|
||||
host := global.GVA_CONFIG.Email.Host
|
||||
port := global.GVA_CONFIG.Email.Port
|
||||
isSSL := global.GVA_CONFIG.Email.IsSSL
|
||||
|
||||
auth := smtp.PlainAuth("", from, secret, host)
|
||||
e := email.NewEmail()
|
||||
|
||||
Reference in New Issue
Block a user