1package message
2
3import (
4 "github.com/mjl-/mox/dns"
5)
6
7// HeaderCommentDomain returns domain name optionally followed by a message
8// header comment with ascii-only name.
9//
10// The comment is only present when smtputf8 is true and the domain name is unicode.
11//
12// Caller should make sure the comment is allowed in the syntax. E.g. for Received,
13// it is often allowed before the next field, so make sure such a next field is
14// present.
15func HeaderCommentDomain(domain dns.Domain, smtputf8 bool) string {
16 s := domain.XName(smtputf8)
17 if smtputf8 && domain.Unicode != "" {
18 s += " (" + domain.ASCII + ")"
19 }
20 return s
21}
22