Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure DNS for Mailgun with same TXT and CNAME?

Tags:

dns

mailgun

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?

like image 726
mpen Avatar asked Oct 24 '15 01:10

mpen


1 Answers

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.
like image 160
l'L'l Avatar answered Oct 05 '22 00:10

l'L'l