How to Set Up SPF, DKIM and DMARC for Your Email Domain
Correctly configuring SPF, DKIM, and DMARC is essential to ensure that emails are delivered to their recipients. Receiving mail servers use these internet standards to verify the sender. If they are missing or configured incorrectly, emails may end up in the spam folder or be rejected. They also reduce the risk of spoofing and phishing. In this guide, we explain how they work and how to configure them.
Note This guide is intended for domains that use email accounts included with ConsulHosting web hosting. Do you use an external email provider? Use the SPF and DKIM records provided by that provider.
What are SPF, DKIM, and DMARC?
The internet standards SPF, DKIM, and DMARC all use DNS records, but each has a different purpose.
SPF
SPF stands for Sender Policy Framework. An SPF record specifies which mail servers are allowed to send emails on behalf of your domain. When a mail server receives an email, it checks whether the sending server is included in the SPF record.
This makes it more difficult for others to send emails on behalf of your domain without permission.
DKIM
DKIM stands for DomainKeys Identified Mail. With DKIM, the sending mail server adds a digital signature to every outgoing email. The receiving mail server verifies this signature using the public key in your domain’s DKIM record.
This allows the receiving mail server to verify that the email was sent by an authorized mail server and was not modified in transit.
DMARC
DMARC stands for Domain-based Message Authentication, Reporting and Conformance. DMARC uses the results of SPF and DKIM and also checks whether the domain used for these checks matches the domain shown in the sender address. This is known as alignment.
A DMARC policy tells receiving mail servers what to do with emails that fail these checks. You can have these emails processed normally, placed in the spam folder, or rejected entirely. DMARC also allows you to receive reports about emails sent on behalf of your domain.
Setting up SPF
- Log in to the client area.
- On the Domains page, go to DNS.
- Click the domain for which you want to configure SPF.
Note First check whether a TXT record beginning with v=spf1 already exists. SPF is configured automatically when you use the Web Hosting template. In that case, do not create another SPF record.- Click Add Record and select TXT.
- Leave the field under Name empty and leave TTL unchanged.
- Enter the following value under Text:
v=spf1 a mx ip4:185.155.220.220 ip6:2a10:9903:311:c222:0:0:0:1 ~allDoes your web hosting package use different IPv4 and IPv6 addresses? Replace 185.155.220.220 and 2a10:9903:311:c222:0:0:0:1 with the correct addresses.
- Finally, click Create.
Setting up DKIM
- Log in to DirectAdmin.
- Use the domain selector at the top of the page to make sure the correct domain is selected.
- Under E-mail Manager, open the E-mail Accounts page.
- Click Enable DKIM.
- Wait 15 seconds for DKIM to be enabled and then copy the value shown under Value:.
- Log in to the client area.
- On the Domains page, go to DNS.
- Click the domain for which you want to configure DKIM.
- Click Add Record and select TXT.
- Enter
x._domainkeyunder Name and leave TTL unchanged. - Under Text, paste the value you copied in step 5. It will look similar to the following:
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzUNLJ8hpo+nY1In3zS/wjUhofpbKDgLYdwcYHHUXVaMqsN/HtsPG0HsGbCqmvW/V9CXTpXFcYSDf50SkwZ3abCJgNPy3PPIHMMTX/jOw6GopAyvwB3jIspAKXVDyGDwagDdvumYLGpDZ7KbEgfwdcvT3xC1r0thzpq0VCaFF0l7AogYWYXhsYXe+WyxTS6uRWCb+/hGFS2Dc1kPxkzUsXgVw6OK/TwyygPTHK8ep8u5h2DS4JWcGnPz8DzjAWqzSqEOZ8X2H2D26pj9g7FKzWuGr0hNdSYSXx81w35ro4kBpWg4Qf0kOd0ibAfgtg/OhrfcFQOHwedPbH9K1u3s4kxQIDAQAB- Finally, click Create.
Setting up DMARC
Only configure DMARC after setting up SPF and DKIM.
- Log in to the client area.
- On the Domains page, go to DNS.
- Click the domain for which you want to configure DMARC.
- Click Add Record and select TXT.
- Enter
_dmarcunder Name and leave TTL unchanged. - Enter the following value under Text:
v=DMARC1; p=rejectTip You can addruaand optionallyrufto receive DMARC reports. For example, usev=DMARC1; p=reject; rua=mailto:[email protected]; ruf=mailto:[email protected]. Replace[email protected]with the email address at which you want to receive the reports.
Testing SPF, DKIM, and DMARC
After creating the DNS records, it can take up to one hour for the changes to be processed. Wait a while before testing your configuration.
- Open the Internet.nl email test.
- Enter your domain, such as
example.com. - Click Start test and wait for the test to finish.
- In the test report, view the results under Protection against email phishing (DMARC, DKIM and SPF).
- Check the results for SPF, DKIM, and DMARC.
Are the new DNS records not detected yet? Wait a little longer and run the test again.
Note In addition to SPF, DKIM, and DMARC, Internet.nl tests other internet standards, including IPv6, DNSSEC, STARTTLS, DANE, and RPKI. The result may therefore be lower than 100% even when SPF, DKIM, and DMARC are configured correctly.