From 003fec5f838b4871dc7227477d095694531b9908 Mon Sep 17 00:00:00 2001 From: Pierre Couy <> Date: Sat, 29 Jun 2024 15:31:25 +0200 Subject: [PATCH] Add Date header to sent e-mails --- server/smtp_sender.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/smtp_sender.go b/server/smtp_sender.go index 21eaf682..6aa3c574 100644 --- a/server/smtp_sender.go +++ b/server/smtp_sender.go @@ -110,9 +110,11 @@ func formatMail(baseURL, senderIP, from, to string, m *message) (string, error) if trailer != "" { message += "\n\n" + trailer } + date := time.Unix(m.Time, 0).Format(time.RFC1123Z) subject = mime.BEncoding.Encode("utf-8", subject) body := `From: "{shortTopicURL}" <{from}> To: {to} +Date: {date} Subject: {subject} Content-Type: text/plain; charset="utf-8" @@ -122,6 +124,7 @@ Content-Type: text/plain; charset="utf-8" This message was sent by {ip} at {time} via {topicURL}` body = strings.ReplaceAll(body, "{from}", from) body = strings.ReplaceAll(body, "{to}", to) + body = strings.ReplaceAll(body, "{date}", date) body = strings.ReplaceAll(body, "{subject}", subject) body = strings.ReplaceAll(body, "{message}", message) body = strings.ReplaceAll(body, "{topicURL}", topicURL)