|
@@ -2,10 +2,8 @@ package mail
|
|
|
|
|
|
import (
|
|
import (
|
|
"crypto/tls"
|
|
"crypto/tls"
|
|
- "fmt"
|
|
|
|
"github.com/astaxie/beego/logs"
|
|
"github.com/astaxie/beego/logs"
|
|
"gopkg.in/gomail.v2"
|
|
"gopkg.in/gomail.v2"
|
|
- "net/url"
|
|
|
|
settings2 "nginx-ui/server/modules/settings"
|
|
settings2 "nginx-ui/server/modules/settings"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
@@ -67,7 +65,7 @@ func SendEmail(to string, subject string, body string, sender *Sender) error {
|
|
defer closer.Close()
|
|
defer closer.Close()
|
|
m := gomail.NewMessage()
|
|
m := gomail.NewMessage()
|
|
|
|
|
|
- from := fmt.Sprintf("%s <%s>", url.QueryEscape(sender.Nickname), sender.Username)
|
|
|
|
|
|
+ from := m.FormatAddress(sender.Username, sender.Nickname)
|
|
|
|
|
|
m.SetHeader("From", from)
|
|
m.SetHeader("From", from)
|
|
m.SetHeader("To", to)
|
|
m.SetHeader("To", to)
|