SPF, DKIM and DMARC explained – why your emails end up in spam
Your website sends emails, but they end up in the spam folder or never arrive. Often this is not Joomla's fault but three short records in your domain's DNS: SPF, DKIM and DMARC. Here I explain what each of them does, what it looks like and in which order to set them up.
An email is like a letter on which anyone can write any sender. That is why the large mailbox providers check whether an email really comes from the domain shown as the sender. To do this, they look up that domain's DNS. Since February 2024, Google and Yahoo require at least SPF or DKIM from all senders, and all three records from large senders. Without them, the email lands in spam or is rejected.
SPF: who may send for your domain?
SPF is a list of the servers allowed to send emails with your domain as the sender. It is a TXT record on the domain itself and looks like this, for example:
v=spf1 mx include:_spf.your-mail-provider.com -all
- mx allows the servers that also receive your mail.
- include: adopts your mail provider's list. Your provider tells you the exact value.
- -all at the end means: nobody else is allowed.
~allmeans “probably not” and is a cautious start.+allallows anyone to send in your name and makes the record worthless.
Three rules where it often goes wrong:
- Exactly one SPF record. Two records invalidate both. New senders go into the existing record.
- At most ten lookups. Every
includecounts, including nested ones. Adding too many services makes the check fail. - Include every sender. If your website sends directly from the web server (PHP Mail), that server must be in the record. If it sends via your provider's mailbox (SMTP), the provider's entry is enough. Newsletter services usually need an
includeof their own.
DKIM: the signature on every email
DKIM signs every outgoing email digitally. Your mail provider's server adds the signature with a secret key. The matching public key is in the DNS, under a name like selector._domainkey.your-domain.com. The recipient fetches it there and checks whether the email was changed on the way.
You do not make up the selector and the key yourself. Your mail provider generates both, usually with a switch in its control panel. You then only add the record to the DNS, if the provider does not do this for you.
If Joomla sends with PHP Mail directly from the web server, often nobody signs at all. That is a good reason to switch to SMTP via a real mailbox of your domain under System → Global Configuration → Server.
DMARC: what happens to emails that fail?
DMARC combines SPF and DKIM and tells the recipient what to do with emails that pass neither check. The record is located at _dmarc.your-domain.com and looks like this at the start:
v=DMARC1; p=none; rua=mailto:
- p=none only observes. Nothing is rejected, but you receive reports.
- p=quarantine sends suspicious emails to spam.
- p=reject rejects them.
- rua is the address for the daily reports. Without it,
p=nonestays ineffective forever, because you never find out what happens.
Alignment is important: the domain in the visible sender must match the domain confirmed by SPF or DKIM. An email that your newsletter service signs with its own domain passes DKIM, but not DMARC.
The order to follow
- Find out who sends. How does Joomla send (PHP Mail, Sendmail or SMTP)? Which other services send in your name, such as newsletters or a shop?
- Set SPF and include all senders, initially with
~all. - Switch on DKIM at your mail provider and get the key into the DNS.
- Set up DMARC with p=none and a report address.
- Tighten after a few weeks. When the reports show that your own emails get through, switch to
quarantineand later toreject.
Your domain provider sets the records, or you do it yourself in its DNS management. Changes take a few minutes to a few hours to arrive everywhere.
Typical mistakes
- A second SPF record for a new service instead of adding to the existing one.
- A forgotten sender. The website sends via the web server, but SPF only lists the mail provider.
- A foreign sender address. A contact form sets the visitor's address as the sender. Your domain has no permission for that, and the email fails. Better: your own address as the sender, the visitor's as the reply-to address.
- DMARC on reject too early. Then your own emails disappear too, as long as not everything is right.
How to see whether everything is right
Anyone can query the records in the DNS. The hard part is reading them correctly and keeping an eye on them, because a change at the provider or a new service quickly throws everything off.
That is exactly why Mail Log has a domain health check. It checks SPF, DKIM, DMARC and MX of your sender domain from your own server and shows the result as a traffic light on the dashboard. Each finding says in plain language what is missing and where to fix it: two SPF records, too many lookups, a DMARC record that only observes and collects no reports. For DKIM, you enter your provider's selector once in the options.
The Free version costs nothing and has no time limit. The Pro version calculates the ready-made DNS record for each finding, with a copy button, and evaluates the DMARC reports you receive.
This article is also available in German.

Related extension
A question about this topic, or an idea for the next guide? Write to me.
Norbert Graup
One membership: all Pro versions, updates and personal support.














