How to configure DNS for Mailgun with same TXT and

2020-06-03 00:17发布

问题:

Mailgun is telling me to set up a TXT record for mg.mydomain.com with a value of v=spf1 ... plus a CNAME record for email.mg.mydomain.com with value mailgun.org.

I did that, and mailgun verified my domain no problem. The issue is when I send emails, certain receiving mail servers are rejecting my emails with message "Sender address rejected: Domain not found". I'm pretty sure this is because "mg.mydomain.com" doesn't exist -- I don't have a CNAME for it. However, I can't create a CNAME for it because it's already used for the TXT record.

So now I don't know what to do. Can I put this v=spf1 thing in a different TXT record so that I can free up the mg. CNAME, so that sender-verification will work on these picky servers?

回答1:

It appears the missing ingredient is an A record for mg.mydomain.com

A

mg.mydomain.com.  A  nnn.nnn.nnn.nnn:

If email.mg.mydomain.com CNAME is in the same DNS zone as mydomain.com, mg.mydomain.com, etc. and there's an A record with the ip pointing back to the hostname then setting up the CNAME, TXT, and MX records should be straightforward:

CNAME

email.mg.mydomain.com.  CNAME   mailgun.org.

TXT

mydomain.com.   TXT  v=spf1 a include:mailgun.org ~all

(optional for receiving)

MX

mydomain.com.   MX  mxa.mailgun.org.
mydomain.com.   MX  mxb.mailgun.org.


标签: dns mailgun