mox/mox-/msgid.go

14 lines
344 B
Go
Raw Normal View History

2023-01-30 16:27:06 +03:00
package mox
import (
cryptorand "crypto/rand"
2023-01-30 16:27:06 +03:00
"encoding/base64"
)
// MessageIDGen returns a generated unique random Message-Id value, excluding <>.
func MessageIDGen(smtputf8 bool) string {
buf := make([]byte, 16)
cryptorand.Read(buf)
2023-01-30 16:27:06 +03:00
return base64.RawURLEncoding.EncodeToString(buf) + "@" + Conf.Static.HostnameDomain.XName(smtputf8)
}