Skip to content

Commit

Permalink
Add Date header to sent e-mails
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Couy committed Jun 29, 2024
1 parent 9d3fc20 commit 003fec5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/smtp_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit 003fec5

Please sign in to comment.