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:
parent
9d3fc20e58
commit
003fec5f83
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue