mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-29 21:33:31 -06:00
[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:
parent
15e0bf6e5a
commit
c2738474d5
4 changed files with 33 additions and 3 deletions
|
|
@ -31,6 +31,7 @@ import (
|
|||
// Passing a nil function is also acceptable, in which case the send functions will just return nil.
|
||||
func NewNoopSender(sendCallback func(toAddress string, message string)) (Sender, error) {
|
||||
templateBaseDir := config.GetWebTemplateBaseDir()
|
||||
msgIDHost := config.GetHost()
|
||||
|
||||
t, err := loadTemplates(templateBaseDir)
|
||||
if err != nil {
|
||||
|
|
@ -39,12 +40,14 @@ func NewNoopSender(sendCallback func(toAddress string, message string)) (Sender,
|
|||
|
||||
return &noopSender{
|
||||
sendCallback: sendCallback,
|
||||
msgIDHost: msgIDHost,
|
||||
template: t,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type noopSender struct {
|
||||
sendCallback func(toAddress string, message string)
|
||||
msgIDHost string
|
||||
template *template.Template
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +89,7 @@ func (s *noopSender) sendTemplate(template string, subject string, data any, toA
|
|||
return err
|
||||
}
|
||||
|
||||
msg, err := assembleMessage(subject, buf.String(), "test@example.org", toAddresses...)
|
||||
msg, err := assembleMessage(subject, buf.String(), "test@example.org", s.msgIDHost, toAddresses...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue