3

I would like to setup the MX nameservers of a domain domain.com so that every income email goes to mailgun (or other inbound email processor), including all the possible subdomains @*anything*.domain.com except @hq.domain.com that uses Google Apps.

MX servers for Google Apps are:

 MX 1 ASPMX.L.GOOGLE.COM.
 MX 5 ALT1.ASPMX.L.GOOGLE.COM.
 MX 5 ALT2.ASPMX.L.GOOGLE.COM.
 MX 10 ASPMX2.GOOGLEMAIL.COM.
 MX 10 ASPMX3.GOOGLEMAIL.COM.

MX servers for Mailgun are:

MX mxa.mailgun.org 
MX mxb.mailgun.org 

Is this possible to do?

Victor
  • 131
  • 3
  • its already answered, search next time @ http://serverfault.com/a/54807/315572 – Vasil Jamalashvili Nov 23 '15 at 13:26
  • This question is different. I need to receive **all** the possible subdomains in mailgun, not just domain.com, except hq.domain.com that is processed by Google Apps. – Victor Nov 23 '15 at 13:31

1 Answers1

2

in you case

hq               IN      MX      1       ASPMX.L.GOOGLE.COM.
hq               IN      MX      5       ALT1.ASPMX.L.GOOGLE.COM.
hq               IN      MX      5       ALT2.ASPMX.L.GOOGLE.COM.
hq               IN      MX      10      ASPMX2.GOOGLEMAIL.COM.
hq               IN      MX      10      ASPMX3.GOOGLEMAIL.COM.
qh               IN      MX      10      ASPMX4.GOOGLEMAIL.COM.
hq               IN      MX      10      ASPMX5.GOOGLEMAIL.COM.
@          IN      MX      10      mxa.mailgun.org.
@          IN      MX      10      mxb.mailgun.org.
*.domain.com.       IN  MX  10 mxa.mailgun.org.
*.domain.com.       IN  MX  10 mxb.mailgun.org.
  • Thank you for your answer. Will I be able to receive, for example, mails for peter@something.domain.com in Mailgun and be sure that paul@hq.domain.com is received in Google Apps? – Victor Nov 23 '15 at 13:33
  • i have edited answer and added wildcard mx, you should receive user@hq.domain.com at google apps and all other user@*.domain.com at mailgun, hope this helps – Vasil Jamalashvili Nov 23 '15 at 13:34
  • p.s : wildcard MX is documented at http://tools.ietf.org/html/rfc1912#section-2.7 – Vasil Jamalashvili Nov 23 '15 at 13:36
  • 1
    @VasilJamalashvili The wildcard will only be used for names that don't appear explicitly in the domain. Wildcards are not type-specific, so an A record for `www.mailgun.com` will prevent the wildcard from being used for mail to `user@www.mailgun.com`. – Barmar Nov 23 '15 at 20:20
  • @Barmar thanks for correction, as i imagine, separate mx records must be added for each existing subdomain, i don't see any other solution. – Vasil Jamalashvili Nov 24 '15 at 03:51
  • The best solution is to configure your outgoing mail so it doesn't use subdomains in the `From` addresses, then you shouldn't have to worry about incoming mail to subdomains. – Barmar Nov 24 '15 at 05:19
  • @barmar question was about incoming mail, outgoing mail will always work if there is correct mx record and ptr – Vasil Jamalashvili Nov 24 '15 at 17:52