Skip to content

Commit

Permalink
feat: Add date to email headers in Send function (#527)
Browse files Browse the repository at this point in the history
Implement 'Date' header to comply with email RFC standards and enhance
deliverability by satisfying spam filters.
  • Loading branch information
blib authored Jun 13, 2024
1 parent 23273de commit 316e0ef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go/notifications/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/smtp"
"strings"
"time"
)

type Email struct {
Expand Down Expand Up @@ -59,6 +60,7 @@ func (sm *Email) Send(to, subject, contents string, headers map[string]string) e
}
buf.WriteString("From: " + sm.from + "\r\n")
buf.WriteString("To: " + sanitize(to) + "\r\n")
buf.WriteString("Date: " + time.Now().Format(time.RFC1123Z) + "\r\n")
buf.WriteString("Subject: " + sanitize(subject) + "\r\n")
buf.WriteString("Content-Type: text/html; charset=UTF-8\r\n")
buf.WriteString("\r\n")
Expand Down

0 comments on commit 316e0ef

Please sign in to comment.