Sam Brown
Sam Brown

Reputation: 63

MX Record for all heroku review apps

I want to set up heroku and my MX records such that whenever I spin up a review app, eMail can already be routed to it.

For example, if I create a new review app and heroku assigns it the name:

company-feature-email-123abc.staging.example.com

I want there to already be be a wildcard MX record in my zone file to successfully route eMail to that review app.

What's the right way to phrase this MX record?

Upvotes: 0

Views: 60

Answers (1)

kimbo
kimbo

Reputation: 2693

A wildcard MX record would look like this in a DNS zone file:

*.example.com.    IN      MX      10 <mail-server-name>

Make sure to read RFC 1912 section 2.7: Wildcard records. Here's part of it:

Wildcard MXs are useful mostly for non IP-connected sites. A common mistake is thinking that a wildcard MX for a zone will apply to all hosts in the zone. A wildcard MX will apply only to names in the zone which aren't listed in the DNS at all. e.g.,

       podunk.xx.      IN      NS      ns1
                       IN      NS      ns2
       mary            IN      A       1.2.3.4
       *.podunk.xx.    IN      MX      5 sue

Mail for mary.podunk.xx will be sent to itself for delivery. Only mail for jane.podunk.xx or any hosts you don't see above will be sent to the MX. For most Internet sites, wildcard MX records are not useful. You need to put explicit MX records on every host.

See also this answer to a similar question on server fault: https://serverfault.com/a/405640/494284

Upvotes: 1

Related Questions