1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-07 12:24:22 +01:00

Add Date header to sent e-mails

This commit is contained in:
Pierre Couy 2024-06-29 15:31:25 +02:00
parent 9d3fc20e58
commit 003fec5f83

View file

@ -110,9 +110,11 @@ func formatMail(baseURL, senderIP, from, to string, m *message) (string, error)
if trailer != "" { if trailer != "" {
message += "\n\n" + trailer message += "\n\n" + trailer
} }
date := time.Unix(m.Time, 0).Format(time.RFC1123Z)
subject = mime.BEncoding.Encode("utf-8", subject) subject = mime.BEncoding.Encode("utf-8", subject)
body := `From: "{shortTopicURL}" <{from}> body := `From: "{shortTopicURL}" <{from}>
To: {to} To: {to}
Date: {date}
Subject: {subject} Subject: {subject}
Content-Type: text/plain; charset="utf-8" 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}` This message was sent by {ip} at {time} via {topicURL}`
body = strings.ReplaceAll(body, "{from}", from) body = strings.ReplaceAll(body, "{from}", from)
body = strings.ReplaceAll(body, "{to}", to) body = strings.ReplaceAll(body, "{to}", to)
body = strings.ReplaceAll(body, "{date}", date)
body = strings.ReplaceAll(body, "{subject}", subject) body = strings.ReplaceAll(body, "{subject}", subject)
body = strings.ReplaceAll(body, "{message}", message) body = strings.ReplaceAll(body, "{message}", message)
body = strings.ReplaceAll(body, "{topicURL}", topicURL) body = strings.ReplaceAll(body, "{topicURL}", topicURL)