It seems the missing component is the A record for mg.mydomain.com
BUT
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 is A record , where ip indicates the host name, then configure CNAME records, TXT and MX should be simple:
CNAME
email.mg.mydomain.com. CNAME mailgun.org.
Txt
mydomain.com. TXT v=spf1 a include:mailgun.org ~all
(optional for admission)
MX
mydomain.com. MX mxa.mailgun.org. mydomain.com. MX mxb.mailgun.org.
l'l'l
source share