1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00
2023-02-27 20:28:17 -05:00

13 lines
335 B
Go

package soautil
import "strings"
// RFC5322MailToBind converts a user@host email address to BIND format.
func RFC5322MailToBind(rfc5322Mail string) string {
res := strings.SplitN(rfc5322Mail, "@", 2)
user, domain := res[0], res[1]
// RFC-1035 [Section-8]
user = strings.ReplaceAll(user, ".", "\\.")
return user + "." + domain
}