DNS records
- 1
DNS records point to your server
- 2
Get a certificate from Let's Encrypt
- 3
Postfix fetches information from MariaDB
- 4
Dovecot fetches information from MariaDB
- 5
Postfix hands over emails to Dovecot
- 6
Dovecot saves the email to disk
As shown in the slideshow, you need to have proper DNS records set up. Say that you want to receive emails for the
example.com domain. If some other mail server on the internet wants to send an email to your server, it looks for two
records:
-
MX record (
example.com)
The MX (Mail Exchange) record tells other mail servers where to deliver emails for the domainexample.com.
Instead of pointing directly to an IP address, it points to a hostname (for example,smtp.example.com).
MX records also include a priority value. If multiple mail servers are listed, the one with the lowest priority number is tried first. Others are used as fallback if the first is unavailable. -
A / AAAA record (
smtp.example.com)
The hostname specified in the MX record (smtp.example.com) must resolve to an IP address so that other mail servers know how to reach it.- An A record maps the hostname to an IPv4 address.
- An AAAA record maps the hostname to an IPv6 address.
Once resolved, the sending mail server connects to that IP address on TCP port 25, which is the standard port for email delivery (SMTP).
In zone syntax you would create something like:
@ IN MX 10 smtpsmtp IN A 100.64.17.3smtp IN AAAA fd7a:115c:a1e0::17If possible, also add a PTR record that makes the IP addresses point back to the name smtp.example.com. Other mail
servers may be more likely so flag your sent emails as spam if you do not have a PTR record. Preferable the forward
(A/AAAA) and reverse (PTR) records match.