If you’re familiar with DNS records (Domain Name System records), you might think that CNAME records have little to do with sending emails. And while generally they aren’t used for email and aren’t necessary for email sending, they do play an important role if you want to make use of specific advanced features.
So, if you want to learn how to optimize your email sending with additional bounce processing and tracking features, this article is for you. We’ll explain what CNAME records are and how they work, how they fit into email sending, and how to set them up. Off we go!
What is a CNAME record?
A Canonical name record—known more commonly as a CNAME record—is a type of DNS record that links an alias of a domain to the root domain. CNAME records are often used for subdomains, for example, blog.domain.com. Instead of an A record pointing to the IP of the domain, the CNAME record will point to the root domain, domain.com, where the IP can be resolved. The root domain can also be referred to as the canonical name of the subdomain, hence the CNAME record.
In this context, CNAME records are instrumental, as all subdomains or aliases belonging to the root domain will point to the root domain for their IP lookup. This means if the IP address linked with a domain changes, you only have to change the IP address once, in the A record of the root domain.
CNAME records and email
You might be wondering how a DNS record that links domains has anything to do with email. Well, it actually plays a very specific and essential part in custom URL tracking and return-path implementation. In order to use both of these features of your email delivery provider, you’ll need to add a CNAME record. To understand why this is necessary, we’ll first need to take a look at how it all works.
How CNAME records work
So we know that CNAME records help to link domain aliases and root domains but how does it resolve the domain names to IP addresses?
When a browser sends a DNS lookup request for a domain alias that has a CNAME record, the DNS server will return another domain name, usually the canonical (root) domain. The browser will then send another DNS query to the root domain where the IP address in the domain’s DNS A record will be located. The IP address will then be returned to the browser for it to connect with the domain’s hosting server so that the content can be displayed.
Example of a CNAME record
All domain hosts have slightly different wording and ways of setting up a CNAME record, but generally, the values you enter will be the same. Here’s a basic example of a CNAME record.
Type = CNAME
Host = blog
Value = domain.com
TTL = 3600
How CNAME records are used for email
If you want to step up your transactional email strategy to a more pro level, CNAME records are one way you can do that. Here’s how:
Tracking and analytics
Any good email service provider (ESP) will include various analytics and tracking options (check out MailerSend’s analytics feature). The thing is, to be able to track clicks from links in your email, the ESP will need to replace the actual links with their own. This is so they can include a trackable URL and a unique tracking ID.
For example, here’s how the URL might look in MailerSend:
This is where CNAMEs come in handy. By creating a CNAME record in your DNS, you can use your own domain in your tracking URLs. This is the ideal solution for businesses that want to be more professional in their emails, and increase trust by using a recognizable domain in their email links. Plus, using white-label links in your emails will increase the chances of your emails being delivered to the inbox instead of the spam folder, improving your deliverability.
When a recipient clicks on a link in your email, the CNAME record for the subdomain will point to the ESP’s tracking URL. This will allow them to track clicks on your behalf while keeping your own domain visible to recipients.
In MailerSend, you can choose your own unique subdomain for tracking URLs. Then, we’ll create the CNAME values for you and all you have to do is create the record in your DNS.
Check out our Domain tracking options guide to learn more.
Setting up a Return-Path email address
When you’re sending emails at scale, you definitely want to track bounces so that you can monitor and maintain your deliverability. This is made possible by using the Return-Path header in your emails. When an email bounces, the details are sent to the email address set as your Return-Path.
So that your ESP can collect and display this data to you in their interface and via API, you need to set a CNAME record linking your Return-Path email domain with your ESP’s domain. This will allow them to receive and process the feedback on your behalf
With MailerSend, we’ll provide a CNAME record for your Return-Path, so all you have to do is copy it over to your DNS records.
DKIM, or DomainKeys Identified Mail, is a type of email authentication record set up in your DNS. You MUST have DKIM implemented in order to send emails securely.
DKIM is usually added to your DNS as a TXT record, but occasionally your ESP may require you to add it as a CNAME record. In this case, the record will be a pointer to another record that contains your DKIM public key rather than containing the key itself.
Learn more about email authentication and other DNS records.
How to set up a CNAME record
Setting up a CNAME record is super simple! But it does vary from provider to provider. Generally speaking, you’ll need to log in to your domain provider account and head to the domain settings for the domain you would like to add the record for. Locate the option to add a new DNS record and select the type as CNAME, then proceed to enter the relevant values. Save and allow the new settings to propagate!
You can find more information on email authentication and how to set up DNS records for specific providers such as GoDaddy, Cloudflare and Google Cloud in our guide.
Rules and limitations of CNAME records
CNAME is pretty easy to implement, and your provider will give you the correct values and instructions on how to add them to your DNS. But there are a few points worth noting:
1. CNAME records must always point to a domain name, not to an IP address. Pointing to an IP address is invalid and will not return the correct response. If you want to point to an IP address, you should use the A record.
2. You cannot have multiple CNAME records with the same hostname, or any other DNS record for that matter. The exception is DNSSEC records.
3. Domains used for sending emails shouldn’t have CNAME records as some mail servers may not respond correctly. Instead, you should use separate subdomains for any email-related purposes.
4. You can point a CNAME record to another CNAME record, however, this can make the lookup process less efficient.
5. NS and MX records should never point to a CNAME alias as this is forbidden by RFC specifications.
Common misconceptions about CNAME records
1. CNAME records are just URL redirects. This is incorrect, though the confusion is understandable! A CNAME record points a domain alias to another domain name, usually the root domain. A URL redirect points one URL to another URL. This makes CNAME records and URL redirects actually quite different in their purpose and function.
2. A CNAME record should always resolve to the domain it points to. This isn’t true, either! The purpose of the CNAME record is simply to resolve to the same IP address as the root domain.
Boost your email sending with CNAME’s help
CNAME records are essential if you want to use the more advanced features for custom domain tracking and Return-Path. By white-labeling your email links, your emails will be more likely to reach the inbox, increasing your overall deliverability. Plus, with Return-Path, you can more easily track bounces to identify delivery issues before they impact your sender reputation.
Both of these options are super easy to implement with CNAME records, so you can be tracking emails like a pro in no time!
CNAME records perform a pretty simple function—pointing from a domain alias (subdomain) to the root domain. If you follow the rules and limitations and only use CNAME records for the intended purpose, you’ll avoid any hiccups with your DNS settings.
Get advanced email activity and analytics with MailerSend
Sign up for free and get 3,000 emails per month plus access to tons of great features.