How do I properly create a subdomain to be used by Mailgun?

  1. I want to create the subdomain mg.example.com to be used by mailgun.
    Do I add a new A/AAAA record for 'mg' in the example.com domain zone
    or
    Do I create a new domain zone called 'mg.example.com' as I've seen in a guide elsewhere (with no A/AAAA records of any type).

  2. When adding the MX record for the mxa.mailgun.org server, does the subdomain field refer to the 'mg' subdomain created in the previous step?

  3. When adding the mailgun TXT Record for SPF, do I map the 'mg' subdomain (as hostname) to the spf value. I've seen guides where the subdomain is mapped and others where it is left empty and only the spf entered.

Apologies, information on using Linode with Mailgun seems to be quite sparse out there.

2 Replies

I want to create the subdomain mg.example.com to be used by mailgun.
Do I add a new A/AAAA record for 'mg' in the example.com domain zone
or
Do I create a new domain zone called 'mg.example.com' as I've seen in a guide elsewhere (with no A/AAAA records of any type).

Yes, you would just need to go with option #1 and add a new A/AAAA record for mg in the example.com domain zone.

For additional context I wanted to link to our guide on configuring subdomains (if needed):

https://linode.com/docs/networking/dns/common-dns-configurations/#configure-subdomains

When adding the MX record for the mxa.mailgun.org server, does the subdomain field refer to the 'mg' subdomain created in the previous step?

Yes. You should be able to confirm this is resolving correctly with the following command (for example):

dig +short MX mg.example.com
10 mxa.mailgun.org.

When adding the mailgun TXT Record for SPF, do I map the 'mg' subdomain (as hostname) to the spf value? I've seen guides where the subdomain is mapped and others where it is left empty and only the spf entered.

Yes, I believe you would just map the mg subdomain (as hostname) to the SPF value. You could confirm if the the TXT record takes with the following command (the output would looks something like the following):

dig TXT mg.example.com

; <<>> DiG 9.10.6 <<>> TXT mg.example.com
...
;; QUESTION SECTION:
;mg.example.com.    IN  TXT

;; ANSWER SECTION:
mg.example.com. 86400 IN    TXT "v=spf1 include:mailgun.org ~all"

;; AUTHORITY SECTION:
example.com. 86400    IN  NS  ns1.linode.com.
example.com. 86400    IN  NS  ns5.linode.com.
example.com. 86400    IN  NS  ns2.linode.com.
example.com. 86400    IN  NS  ns3.linode.com.
example.com. 86400    IN  NS  ns4.linode.com.

Apologies, information on using Linode with Mailgun seems to be quite sparse out there.

It's not a problem! Hopefully your question here can help fill some of that void :)

Many thanks for your helpful response.
I have now successfully set up mailgun for my domains with the suggested records.

There is one issue left that is most likely a query for mailgun. But I'll leave this here in case others are contemplating the same.

If using a subdomain (e.g. mg.example.com) as recommended by mailgun for separation of domain reputations you can still SEND emails from any address of your BASE domain name.

e.g. outgoing@example.com (address customers see when you email them)

However, if you want to RECEIVE incoming email using this subdomain setup you must have your customers include the subdomain in the incoming email address.

e.g. incoming@mg.example.com

I would like my customers to simply email 'anyname@example.com' wihtout having to include the 'mg' portion of the address. In effect, they can 'reply' to the outgoing address.

I don't know if it's possible to configure this using a subdomain.
What I do know is that you don't need to use a subdomain at all and have all incoming and outgoing mail use the base domain address only. However, now you don't have a separation of domain reputations.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct