diff --git a/pkg/mail/send_mail.go b/pkg/mail/send_mail.go index 0ff34704c..1183fbd33 100644 --- a/pkg/mail/send_mail.go +++ b/pkg/mail/send_mail.go @@ -17,14 +17,13 @@ package mail import ( - "crypto/rand" "embed" - "encoding/hex" "fmt" "io" "code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/log" + "code.vikunja.io/api/pkg/utils" "code.vikunja.io/api/pkg/version" "github.com/wneessen/go-mail" @@ -83,9 +82,8 @@ func getMessage(opts *Opts) *mail.Msg { // Set an RFC 5322 compliant Message-ID using the public URL domain // instead of relying on os.Hostname() which is unreliable in containers. - randBytes := make([]byte, 16) - _, _ = rand.Read(randBytes) - messageID := hex.EncodeToString(randBytes) + "@" + GetMailDomain() + randPart, _ := utils.CryptoRandomString(32) + messageID := randPart + "@" + GetMailDomain() m.SetMessageIDWithValue(messageID) if opts.From == "" { opts.From = "Vikunja <" + config.MailerFromEmail.GetString() + ">"