From 69e2778b3d53ba990c54678de807f3d3564267ff Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 21 Aug 2020 20:16:17 -0400 Subject: [PATCH] add required date header --- main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index fd5a728..cc7e272 100644 --- a/main.go +++ b/main.go @@ -7,13 +7,13 @@ import ( "encoding/base32" "encoding/json" "fmt" + "github.com/jmoiron/sqlx" + "golang.org/x/crypto/bcrypt" "html/template" "log" "net/smtp" "strings" - - "github.com/jmoiron/sqlx" - "golang.org/x/crypto/bcrypt" + "time" ) type templates struct { @@ -467,10 +467,12 @@ func SendMail(addr, from, subject, body string, to string) error { return err } + date := time.Now() msg := "To: " + to + "\r\n" + "From: " + from + "\r\n" + "Subject: " + subject + "\r\n" + "Content-Type: text/html; charset=\"UTF-8\"\r\n" + + "Date: " + date.Format(time.RFC1123Z) + "\r\n" + "\r\n" + body _, err = w.Write([]byte(msg))