Skip to content

Commit

Permalink
Merge pull request #1141 from pcouy/smtp-sender-date-header
Browse files Browse the repository at this point in the history
Add Date header to sent e-mails
  • Loading branch information
binwiederhier authored Sep 29, 2024
2 parents 78533e2 + 003fec5 commit fc3624c
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 fc3624c

Please sign in to comment.