You send an email to a customer, but it doesn't appear in their Inbox. Sometimes the message ends up in the Spam folder, while in other cases the recipient's mail server refuses to accept it altogether.
There may be several reasons for this: the IP address's reputation, the content of the email, mail server settings, or the recipient's filtering policies.
But there is another important factor: missing or incorrectly configured email authentication mechanisms.
SPF, DKIM and DMARC help mail servers verify whether the sender is authorized to use the specified domain and whether the email has passed the required authentication checks.
Let's take a look at how these technologies work, why they are needed, and how to configure them correctly for your domain.
Why Do Mail Servers Check the Sender?
Imagine this situation: an attacker sends an email using your domain, for example support@example.com, even though they have no connection to your company.
The recipient sees a familiar address and may mistake the message for a legitimate one. This type of sender impersonation is called spoofing and is often used in phishing attacks.
The problem lies in how email works: simply specifying an address in the From field does not prove that the sender is actually authorized to use that domain.
That's why mail servers use additional verification mechanisms. The three main technologies are:
- SPF (Sender Policy Framework) — specifies which servers are authorized to send email on behalf of a domain.
- DKIM (DomainKeys Identified Mail) — allows the recipient to verify the message's digital signature.
- DMARC (Domain-based Message Authentication, Reporting and Conformance) — aligns SPF and DKIM results with the sender's domain and defines a policy for handling messages that fail authentication.
These mechanisms complement one another and help protect a domain against sender spoofing.
SPF: Who Is Authorized to Send Email on Behalf of a Domain?
SPF is a mechanism that allows a domain owner to specify which servers are authorized to send email on its behalf.
To do this, a special TXT record containing a list of permitted sending sources is published in DNS.
When the recipient's mail server receives a message, it checks the sending server's IP address against the published SPF record.
It is important to understand that SPF does not check the sender address visible to the user in the From field. Instead, it checks the domain used in the technical SMTP MAIL FROM parameter (also known as the envelope sender). This is the domain matched against the sending server's IP address. DMARC later checks whether this domain aligns with the domain in the visible From field.
If the server complies with the rules, the SPF check can pass. Otherwise, the message fails SPF authentication.
What Does an SPF Record Look Like?
Example:
example.com. TXT "v=spf1 ip4:203.0.113.10 mx -all"
In this example:
- v=spf1 — identifies the SPF version.
- ip4:203.0.113.10 — authorizes sending from the specified IPv4 address.
- mx — authorizes sending from the servers listed in the domain's MX records.
- -all — indicates that all other sources are unauthorized.
The IP address in this example is for demonstration purposes only. In a real configuration, you should use the addresses and mechanisms provided by your email service provider.
If you send email not only from your own server but also through third-party services, those services must also be included in your SPF record. The include mechanism can be used for this purpose.
Important SPF Rules
There should be only one SPF record for each domain.
If you use several email services, you cannot simply add multiple separate TXT records containing v=spf1. All authorized sources must be combined into one valid record.
You should also keep in mind SPF's limit on the number of DNS lookups performed during verification. An overly complex record can result in a permerror.
Do not add every possible server to your SPF record just in case. Specify only the sources that actually send email on your behalf.
DKIM: A Digital Signature for Every Email
DKIM addresses a different issue. It allows the recipient to verify that the message was actually signed by the domain specified in the digital signature and that the signed parts of the email have not been altered after signing.
It uses public-key cryptography.
The principle is fairly straightforward:
1. The sender's mail server signs the message using a private cryptographic key.
2. A special DKIM-Signature header is added to the email.
3. The public key is published in the domain's DNS.
4. The recipient's mail server retrieves the public key and verifies the digital signature.
If verification succeeds, the recipient gets additional confirmation of the message's authenticity and the integrity of its signed parts.
What Does a DKIM Record Look Like?
DKIM uses a TXT record containing the public key. Its name is formed using a selector.
selector1._domainkey.example.com
Here, selector1 is the selector that identifies which key should be used to verify the signature.
The record value itself contains key parameters, including v=DKIM1, the key type, and the public part of the cryptographic key.
A simplified example of its structure:
v=DKIM1; k=rsa; p=PUBLIC_KEY
In a real configuration, the public key value is much longer. You need to obtain it from your email provider or generate it using the mail server you are running.
Why Is DKIM Needed?
The main advantage of DKIM is that it allows a digital signature to be verified independently of the IP address of the server from which the email was received.
This is particularly useful if you use several email services or send messages through third-party platforms.
For example, regular corporate email may be sent through your own server, while marketing campaigns are handled by a specialized service. Each source can sign messages using its own DKIM key.
For DMARC to pass, the domain specified in the DKIM signature must align with the sender's domain.
DMARC: What Happens to Emails That Fail Authentication?
SPF and DKIM help verify the sender's authenticity, but on their own they do not define an overall policy for handling messages that fail authentication.
That is what DMARC is for.
A special TXT record is published in DNS. It tells recipients how to handle messages that fail DMARC authentication and can also request reports about authentication results.
DMARC uses SPF and DKIM results but adds another important requirement: domain alignment.
What Is Alignment?
Imagine that a user sends an email from this address:
user@example.com
However, the sending server actually uses a different domain in the message's technical parameters.
A regular SPF or DKIM check may pass, but that does not necessarily mean the message has passed DMARC.
For DMARC to pass, at least one of the mechanisms — SPF or DKIM — must pass authentication and use a domain that aligns with the domain in the From field.
Alignment can be strict or relaxed. In relaxed mode, the organizational domains may match, while strict mode requires the domains to match exactly.
That is why simply adding SPF and DKIM records to DNS is not enough. You also need to make sure they work correctly with the actual sender address.
What Does a DMARC Record Look Like?
Example of an initial policy:
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com"
Let's look at the parameters:
- v=DMARC1 — the protocol version.
- p=none — a monitoring policy that does not request messages to be quarantined or rejected.
- rua=mailto:dmarc@example.com — the address used to receive aggregate DMARC reports.
There are three main DMARC policy values:
p=none — monitoring.
The recipient is not instructed by the domain owner to send messages that fail authentication to spam or reject them. The main purpose of this stage is to collect reports and identify which servers are sending email on behalf of the domain.
p=quarantine — quarantine.
The domain owner asks recipients to place messages that fail DMARC authentication in the junk folder or apply other quarantine measures.
p=reject — rejection.
The domain owner asks recipients to reject messages that fail DMARC authentication.
Important: recipients may take this policy into account when making their own delivery decisions. DMARC does not force every mail server to follow the sender's instructions unconditionally.
Why Shouldn't You Set p=reject Immediately?
This is one of the most common mistakes when configuring DMARC.
If your company uses several email sending sources, you need to make sure that each one is configured correctly.
For example:
- Corporate email on your own server.
- A CRM system.
- An automated notification service.
- A marketing email platform.
- An invoicing and notification system.
If even one legitimate source is not configured properly, its messages may fail DMARC authentication and be rejected by recipients that enforce the published policy.
That is why it makes sense to start with p=none, analyze the reports, fix any issues, and only then gradually move to a stricter policy once all sending sources have been checked.
How Do SPF, DKIM and DMARC Work Together?
Let's look at a typical situation.
A company sends a customer an email from support@example.com.
When the message arrives, the recipient's mail server checks:
SPF: Is the sending server authorized to send email on behalf of the relevant domain?
DKIM: Is the message's digital signature valid, and have the signed parts of the email remained unchanged?
DMARC: Has at least one of the SPF or DKIM checks passed, and does the authenticated domain align with the domain in the From field?
If DMARC passes, the recipient gets confirmation that the sender's domain is being used by an authorized source.
If authentication fails, the mail server may take the published DMARC policy into account when deciding whether to deliver the message.
However, even passing all three checks does not guarantee that an email will reach the Inbox. Email providers also evaluate sender reputation, message content, user complaints, and other factors.
Common SPF, DKIM and DMARC Configuration Mistakes
Even if DNS records are present, that does not necessarily mean email authentication is working correctly.
Here are some of the most common issues.
Multiple SPF records.
If several records containing v=spf1 are published for the same domain, this can cause a verification error. All authorized sources must be combined into a single record.
Not all sending sources are included in SPF.
For example, corporate email works, but messages sent from the CRM fail SPF authentication because its servers have not been added to the authorized sources.
Incorrect DKIM selector.
The mail server signs messages using one selector, while a different selector is published in DNS. As a result, the recipient cannot find the corresponding public key.
Outdated DKIM key.
After changing your email service settings, the key published in DNS may no longer match the key used to sign messages.
DMARC configured without checking alignment.
SPF and DKIM may both pass, but DMARC can still fail if the domains do not align.
DMARC policy that is too strict.
Switching to p=reject without first checking all sending sources can result in legitimate emails being lost.
Incorrect DNS record.
Typos, extra quotation marks, an incorrect record name, or an invalid value can make the configuration unusable.
How Can You Check Whether Your Settings Are Correct?
After adding DNS records, you should make sure they have actually been published and are working correctly.
You can use several tools for this purpose.
MXToolbox
Allows you to check SPF, DKIM, DMARC, MX records, and other email infrastructure settings.
Google Admin Toolbox Check MX
Helps check a domain's DNS settings and identify common email configuration issues.
https://toolbox.googleapps.com/apps/checkmx/
DMARC Reports
If your DMARC record includes a rua address, email providers that support aggregate reporting may send XML reports containing authentication results.
These reports contain information about sending sources, SPF and DKIM results, and how the DMARC policy was applied.
Such reports are useful for identifying unknown sending sources and checking whether your own infrastructure is configured correctly.
For easier analysis, you can use specialized DMARC reporting services that convert XML data into easy-to-understand charts and summaries.
Remember that DNS changes do not propagate instantly. After adding or modifying records, you need to allow for the TTL and DNS cache refresh time.
What Should You Prepare Before Contacting Technical Support?
If your emails still end up in spam or cannot be delivered after configuring SPF, DKIM and DMARC, contact your email service provider's or hosting provider's technical support team.
To help specialists investigate the issue more quickly, we recommend preparing the following information.
1. Sender domain.
Specify the domain used to send email and the full sender address.
2. Recipient address.
Specify the recipient's email service: Gmail, Outlook, Yahoo, or a corporate mail server.
3. An example of the problematic email.
If the email ended up in spam or was rejected, attach its original headers (Full Headers / Original Message). They show the results of SPF, DKIM and DMARC checks, as well as the message's technical route.
4. Error message.
If the mail server returned a rejection message, include the full error text and SMTP response code.
5. DNS records.
If you configured email yourself, provide the current SPF, DKIM and DMARC records or attach the results of their verification.
6. Sending source.
Explain where the email is sent from: a hosting mail server, CRM, website, CMS, script, or third-party email service.
Do not send email account passwords, private DKIM keys, tokens, or other confidential information.
The more initial information a specialist has, the faster they can determine whether the issue is related to DNS, mail server settings, authentication, or sender reputation.
Conclusion
SPF, DKIM and DMARC are not just additional DNS records. They are important mechanisms used in modern email infrastructure.
SPF identifies authorized sending sources, DKIM allows the recipient to verify an email's digital signature, and DMARC aligns the results of these checks with the sender's domain and defines a policy for handling messages that fail authentication.
Correct configuration helps protect your domain against sender spoofing, improve email operation transparency, and create better conditions for delivering legitimate messages.
If you use your own domain for corporate email, do not put off configuring these mechanisms. And if you need a reliable platform for hosting your website and email services, take a look at HOSTLIFE's Standard Hosting and Premium Hosting plans.
Check SPF, enable DKIM and configure DMARC. This is an important step towards safer and more reliable email operation.