Skip to content

Commit fc3624c

Browse files
Merge pull request #1141 from pcouy/smtp-sender-date-header
Add Date header to sent e-mails
2 parents 78533e2 + 003fec5 commit fc3624c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/smtp_sender.go

+3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@ func formatMail(baseURL, senderIP, from, to string, m *message) (string, error)
110110
if trailer != "" {
111111
message += "\n\n" + trailer
112112
}
113+
date := time.Unix(m.Time, 0).Format(time.RFC1123Z)
113114
subject = mime.BEncoding.Encode("utf-8", subject)
114115
body := `From: "{shortTopicURL}" <{from}>
115116
To: {to}
117+
Date: {date}
116118
Subject: {subject}
117119
Content-Type: text/plain; charset="utf-8"
118120
@@ -122,6 +124,7 @@ Content-Type: text/plain; charset="utf-8"
122124
This message was sent by {ip} at {time} via {topicURL}`
123125
body = strings.ReplaceAll(body, "{from}", from)
124126
body = strings.ReplaceAll(body, "{to}", to)
127+
body = strings.ReplaceAll(body, "{date}", date)
125128
body = strings.ReplaceAll(body, "{subject}", subject)
126129
body = strings.ReplaceAll(body, "{message}", message)
127130
body = strings.ReplaceAll(body, "{topicURL}", topicURL)

0 commit comments

Comments
 (0)