DNS Setup
Key concepts and best practices for email development.
When using Resend, or any other ESP, you will need to provide permission for the tool to send email on your behalf. This is where DNS (or Domain Name System) settings come in.
DNS configuration is required for each subdomain you use. Luckily, setup is fairly straightforward. If you want to get up and running quickly, simply follow your ESP’s DNS setup instructions. Here’s an example of how it’s done in Resend. Verification can take a few hours, depending on the service, so we recommend waiting a bit before attempting to troubleshoot.
However, if you’d like to learn more about why and how the DNS process works, read on! 👇
Understanding DNS Record Types
You can access your DNS settings by logging in to the hosting service where you purchased your domain. DNS can store multiple record types - the ones relevant to email are:
- TXT (Text) - Used for basic information lookup, often for storing authentication codes
- MX (Mail Exchange) - Used for creating email return paths so inbox providers can properly route things like delivery and bounce records back to your ESP
- CNAME (Canonical Name) - Used for mapping subdomains to host domains. For the purposes of email, this only becomes relevant when configuring link tracking
- CAA (Certificate Authority Authorization) - Used for creating secure HTTPS domain paths. Like CNAME, this only becomes relevant for email when configuring link tracking.
- NS (Name Server) - Defines where the DNS records will be respected. This essentially tells systems where to find your TXT, MX, and all other listed DNS records. Usually you can ignore this, but it can be helpful when troubleshooting
Understanding Email Authentication
Your ESP will require you to input specific records into your DNS configuration. Here’s an example of how it’s done in Resend.
The records your ESP provides will fall under a few different authentication categories:
- DKIM: A TXT record that creates a public authorization key inbox providers use to verify a match between the sending system and the DNS record
- SPF: A TXT record to verify that only authorized IPs are sending mail, and a corresponding MX record to create an email return path for things like delivery and bounce records
- DMARC: A TXT record that tells inbox providers how skeptical to be of incoming mail from your domain. More on DMARC here. While technically optional, this is practically a requirement modern inbox delivery; Gmail in particular.
- Link tracking: Configuring link tracking can vary across ESPs. In Resend, it requires a CNAME and CAA record.
- Receiving mail: Inbound email (as opposed to sending email) will require an additional MX record for accepting email delivery and content information.