From 644ba70e87bf21997d9d2f020216f90b3876359d Mon Sep 17 00:00:00 2001 From: Max Ratmeyer <17440617+MaxRatmeyer@users.noreply.github.com> Date: Tue, 14 Jul 2020 08:33:21 -0400 Subject: [PATCH] Fixed MX records on NS1 (#783) --- providers/ns1/ns1provider.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/providers/ns1/ns1provider.go b/providers/ns1/ns1provider.go index 40d87f98c..4588c3353 100644 --- a/providers/ns1/ns1provider.go +++ b/providers/ns1/ns1provider.go @@ -133,7 +133,9 @@ func buildRecord(recs models.Records, domain string, id string) *dns.Record { Zone: domain, } for _, r := range recs { - if r.Type == "TXT" { + if r.Type == "MX" { + rec.AddAnswer(&dns.Answer{Rdata: strings.Split(fmt.Sprintf("%d %v", r.MxPreference, r.GetTargetField()), " ")}) + } else if r.Type == "TXT" { rec.AddAnswer(&dns.Answer{Rdata: r.TxtStrings}) } else if r.Type == "SRV" { rec.AddAnswer(&dns.Answer{Rdata: strings.Split(fmt.Sprintf("%d %d %d %v", r.SrvPriority, r.SrvWeight, r.SrvPort, r.GetTargetField()), " ")})