From ab33b6571c080458c0591640f7fc3ded6908e2e4 Mon Sep 17 00:00:00 2001 From: liyujie <29959257@qq.com> Date: Fri, 24 Nov 2023 10:33:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=BB=BA=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E5=8F=91=E9=80=81=E9=94=99=E8=AF=AF:=20INVALID=20HEAD?= =?UTF-8?q?ER=20Missing=20required=20header=20field:=20"Date"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/email.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/email.go b/common/email.go index 74f4cccd..5d3ef0de 100644 --- a/common/email.go +++ b/common/email.go @@ -6,6 +6,7 @@ import ( "fmt" "net/smtp" "strings" + "time" ) func SendEmail(subject string, receiver string, content string) error { @@ -16,8 +17,9 @@ func SendEmail(subject string, receiver string, content string) error { mail := []byte(fmt.Sprintf("To: %s\r\n"+ "From: %s<%s>\r\n"+ "Subject: %s\r\n"+ + "Date: %s\r\n"+ "Content-Type: text/html; charset=UTF-8\r\n\r\n%s\r\n", - receiver, SystemName, SMTPFrom, encodedSubject, content)) + receiver, SystemName, SMTPFrom, encodedSubject, time.Now().Format(time.RFC1123Z), content)) auth := smtp.PlainAuth("", SMTPAccount, SMTPToken, SMTPServer) addr := fmt.Sprintf("%s:%d", SMTPServer, SMTPPort) to := strings.Split(receiver, ";")