mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-01-13 10:34:08 +08:00
fix: Fix the issue of garbled Chinese characters in recipient names and email titles in email alerts (#11516)
#11264
This commit is contained in:
parent
50947f4ddc
commit
e3dea80cb7
1 changed files with 5 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"mime"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/smtp"
|
||||
|
|
@ -119,9 +120,11 @@ func parseRecipients(recipient string) []string {
|
|||
|
||||
func buildMessage(config SMTPConfig, message EmailMessage, toList []string) (string, error) {
|
||||
headers := make(map[string]string)
|
||||
headers["From"] = config.From
|
||||
encodedFrom := mime.BEncoding.Encode("UTF-8", config.From)
|
||||
headers["From"] = encodedFrom
|
||||
encodedSubject := mime.BEncoding.Encode("UTF-8", message.Subject)
|
||||
headers["Subject"] = encodedSubject
|
||||
headers["To"] = strings.Join(toList, ",")
|
||||
headers["Subject"] = message.Subject
|
||||
headers["Date"] = time.Now().UTC().Format(time.RFC1123Z)
|
||||
|
||||
if message.IsHTML {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue