DNS Configuration for a Mail Server
Any request made on the internet needs an address to arrive at, and those addresses are powered by DNS. So when you type in https://www.your-domain.com, DNS tells your browser to hit a specific IP address, because the IP address was entered in the DNS record for your-domain.com. Email works the same way
If there is currently any mail server record update with your domain then you have to remove those records first of all.
A Record
(A) record is a multifaceted DNS record type that can be used for almost anything. For an email server, basically create an A record with "mail" as the name, which points to the IP address set up for the mail service domain. This is so that people can use "http://mail.your-domain.com" and log into the webmail interface
For example, if you use a hosting provider or DNS service, it will usually look like this:
MX Record
A Mail Exchange (MX) record specifies the mail server responsible for receiving email messages on behalf of a domain. How the MX record is set up depends on the DNS provider, but it basically points to its own record type and the A record you created above.
For example, if you use a hosting provider or DNS service, it will usually look like this:
The next three records SPF, DKIM, and DMARC are not "required" records, but they are very clearly and very strongly recommended for your mail domains.
Therefore, rather than explaining each, below, we have included screenshots of how a standard DNS provider looks.
SPF Record
DKIM Record
DMARC Record
Note: DNS changes are not propagated instantly. Once your DNS has changed, it can take up to Maximum 24-48 hours (more, in rare cases) to update the local ISP DNS cache so that you can reach your mail server and website.