[bugfix] add Date and Message-ID headers for email (#3031)

* [bugfix] add Date and Message-ID headers for email

This should make spam filters more happy, as most of them grant some
negative score for not having those headers. Also the Date is convenient
for the user receiving the mail.

* make golangci-lint happy
This commit is contained in:
Julian 2024-06-22 23:36:30 +02:00 committed by GitHub
commit c2738474d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 3 deletions

View file

@ -76,11 +76,13 @@ func NewSender() (Sender, error) {
host := config.GetSMTPHost()
port := config.GetSMTPPort()
from := config.GetSMTPFrom()
msgIDHost := config.GetHost()
return &sender{
hostAddress: fmt.Sprintf("%s:%d", host, port),
from: from,
auth: smtp.PlainAuth("", username, password, host),
msgIDHost: msgIDHost,
template: t,
}, nil
}
@ -89,5 +91,6 @@ type sender struct {
hostAddress string
from string
auth smtp.Auth
msgIDHost string
template *template.Template
}