SMTP email communication requires a domain name and DNS records to be configured. This guide explains how to configure DNS records for SMTP mail servers and for when using MailSlurp with a custom domain.

What is DNS?

DNS (Domain Name System) is a hierarchical decentralized naming system that translates human-readable domain names into IP addresses that computers can understand. It is a critical component of the internet infrastructure that enables users to access websites, send and receive emails, and perform other online activities.

The DNS works by maintaining a distributed database of domain names and their associated IP addresses. When a user types a domain name into their web browser, the browser sends a request to a DNS resolver to look up the IP address for that domain name. The DNS resolver queries a series of DNS servers to find the authoritative name server for the domain, which returns the IP address for the domain name. The DNS resolver then caches the IP address for future use, reducing the need for subsequent DNS lookups.

In addition to translating domain names to IP addresses, the DNS system also supports other types of records, such as MX records for email servers, SRV records for service discovery, TXT records for arbitrary text data, and more. These records are stored in DNS zone files that are managed by domain name registrars or DNS hosting providers.

Configuring your own MailServer

Configuring DNS records for SMTP mailservers is an essential step in setting up your email service. DNS (Domain Name System) is responsible for translating domain names into IP addresses that computers can understand. In this guide, we'll walk you through the process of configuring DNS records for SMTP mailservers.

1. A record

The first record you need to configure is an A record. An A record maps a domain name to an IP address. You will need to create an A record for your SMTP server, such as smtp.example.com, that points to the IP address of your mail server. This record helps other mail servers locate your SMTP server when they need to send email to your domain.

Example:

2. MX record

The next record you need to configure is an MX record. An MX record specifies the mail server responsible for accepting email messages for your domain. When a mail server receives an email message for your domain, it will use the MX record to determine where to deliver the message.

Example:

In this example, we're specifying that smtp.example.com is the mail server responsible for accepting email messages for example.com. The number "10" is the priority value, which indicates the order in which mail servers should be used. If you have multiple MX records, the lowest number is the highest priority.

3. PTR record

The PTR record is used to map an IP address to a domain name. This record is essential for spam filters to verify the authenticity of the email source. You will need to create a PTR record that maps your mail server's IP address to the domain name of your SMTP server.

Example:

In this example, we're specifying that the IP address 192.168.1.1 is associated with the domain name smtp.example.com.

4. SPF record

An SPF (Sender Policy Framework) record is used to prevent email spoofing. It is a DNS record that specifies which IP addresses are authorized to send email on behalf of your domain. You will need to create an SPF record that includes the IP addresses of your SMTP server and any other authorized mail servers.

Example:

In this example, we're specifying that any IP address that resolves to the A or MX record for example.com is authorized to send email on behalf of the domain. We're also including the IP address of our SMTP server, 192.168.1.1, and specifying that any other IP address should be treated as a soft fail (~all).

5. DKIM record

DKIM (DomainKeys Identified Mail) is an email authentication method that allows the receiver to check if an email message was actually sent and authorized by the owner of that domain. DKIM works by adding a digital signature to each outgoing message that can be verified by the recipient's mail server. You will need to generate a DKIM key and create a DKIM record in your DNS zone file.

Example:

Setup MailSlurp custom domains

Create a custom domain in the MailSlurp dashboard and obtain the necessary DNS records. Add the TXT, DKIM and MX records to your DNS provider. You can use the MailSlurp dashboard to verify that the records are correct.