Skip to content
← ENGINEERING NOTES
NETWORKING8 min read

From 74 to 97: Hardening Our Email After Meeting Sendmarc

How we took adgstudios.co.za from 74 to 97 on Sendmarc's domain scan with DMARC reject, SPF, DKIM, MTA-STS and TLS-RPT on a self-hosted Mailcow server.

BY ASHLIN DARIUS GOVINDASAMY

We walked into the CTICC in Cape Town thinking our email setup was pretty solid. We walked out with a DMARC education, a box of Tony's Chocolonely from the Sendmarc team, and a domain score of 74 out of 100 that we could not stop thinking about. A few hours of DMARC, SPF, DKIM, MTA-STS and TLS-RPT work later, adgstudios.co.za scores 97. This is exactly how we did it on a self-hosted Mailcow server.

Meeting Sendmarc at the CTICC

Sendmarc is an email security company that helps organisations get to full DMARC enforcement and stop people spoofing their domains. Their team took the time to walk us through how DMARC actually decides what happens to a message, why p=none protects nobody, and why reporting matters as much as policy. It was the clearest explanation of email authentication we have had, and they were generous with it.

In return we showed them our setup: Mailcow, an open-source, Docker-based mail server suite (Postfix, Dovecot, Rspamd, SOGo) running on our own hardware and hosting several domains and mailboxes. They were genuinely surprised at how much a self-hosted stack can do. Then they ran our domain through their free scanner. 74. Challenge accepted.

What the email security score actually measures

Sendmarc's scan splits the score into three ratings. Impersonation looks at DMARC, SPF and DKIM: can someone else send mail pretending to be you? Privacy looks at MTA-STS and TLS-RPT: is mail to you encrypted in transit, and will you hear about it when it is not? Branding looks at BIMI: does your logo appear next to your mail in the inbox?

  • SPF lists the servers allowed to send for your domain.
  • DKIM signs each message with a key published in DNS, so receivers can prove it was not altered.
  • DMARC ties them together: the visible From domain must match (align with) an SPF or DKIM pass, and the policy says what to do when it does not.
  • MTA-STS tells other servers they must use valid TLS when delivering to your MX, closing the downgrade gap in opportunistic STARTTLS.
  • TLS-RPT asks those servers to send you daily reports when TLS delivery to you fails.
  • BIMI publishes your logo, and the big inbox providers want a paid certificate before they show it.

Where we started: 74 out of 100

We already had SPF, Mailcow's DKIM key, a DMARC record at p=quarantine with strict alignment, and a BIMI record pointing at an SVG Tiny PS logo. What we did not have was MTA-STS or TLS-RPT. That was the first gap.

bash
dig +short MX adgstudios.co.za
dig +short TXT adgstudios.co.za            # SPF
dig +short TXT _dmarc.adgstudios.co.za     # DMARC
dig +short TXT dkim._domainkey.adgstudios.co.za   # Mailcow's default selector
dig +short TXT _mta-sts.adgstudios.co.za
dig +short TXT _smtp._tls.adgstudios.co.za
Check what you publish today

Setting up MTA-STS and TLS-RPT

MTA-STS has two parts. A TXT record at _mta-sts announces that a policy exists and gives it an id. The policy itself is a small text file served over HTTPS, with a publicly trusted certificate, at a fixed path on the mta-sts subdomain. The mx line must match your real MX hostname exactly, so check it before you publish anything.

text
_mta-sts.adgstudios.co.za.    TXT  "v=STSv1; id=202611182345"
_smtp._tls.adgstudios.co.za.  TXT  "v=TLSRPTv1; rua=mailto:[email protected]"
DNS records (TXT)
text
version: STSv1
mode: enforce
mx: mail.adgstudios.co.za
max_age: 604800
https://mta-sts.adgstudios.co.za/.well-known/mta-sts.txt

We serve the policy from a tiny nginx container behind a Cloudflare Tunnel, so the HTTPS certificate is handled for us. Serve it as text/plain. We started in mode: testing with a one-day max_age, confirmed it with curl, then moved to enforce with a one-week max_age. Every time you change the policy, change the id in DNS too, otherwise senders keep their cached copy.

bash
curl -i https://mta-sts.adgstudios.co.za/.well-known/mta-sts.txt

openssl s_client -starttls smtp -connect mail.adgstudios.co.za:25 \
  -servername mail.adgstudios.co.za -brief </dev/null
# Want: TLSv1.3, Verification: OK, CN matching your MX
Verify the policy and your MX TLS

The DMARC report gotcha we nearly missed

Before moving DMARC to reject we went looking for our aggregate reports, the XML files Google, Microsoft and others send to the rua address. There were none. The Postfix logs told the story: every report to [email protected] was being rejected with 550 User unknown, because the address in our DMARC record had never been created as a mailbox or alias. For days we had been asking the internet for feedback and bouncing all of it.

bash
docker compose logs --since 168h postfix-mailcow | grep 'to=<postmaster@' | grep reject
docker compose exec postfix-mailcow postmap -q postmaster@adgstudios.co.za \
  mysql:/opt/postfix/conf/sql/mysql_virtual_alias_maps.cf
Is your rua address actually deliverable? (run in the Mailcow directory)

One alias in the Mailcow admin UI fixed it. If you take one thing from this post: send a test mail to the address in your rua= tag. It costs ten seconds.

QUICK CHECK

With aspf=s and adkim=s, mail relayed through a provider like Brevo passes DMARC how?

Moving DMARC to p=reject and SPF to -all

Our outbound mail is signed twice with aligned keys: Mailcow's Rspamd signs with d=adgstudios.co.za, and our relay provider signs again with a key published under our own domain. That gave us the confidence to move from quarantine to reject, and to tighten SPF from soft fail to fail.

text
adgstudios.co.za.         TXT "v=spf1 mx a:mail.adgstudios.co.za include:spf.brevo.com -all"
_dmarc.adgstudios.co.za.  TXT "v=DMARC1; p=reject; rua=mailto:[email protected]; ruf=mailto:[email protected]; aspf=s; adkim=s"
The final records
›Should you go straight to reject?

Usually not. The textbook path is p=none, read a few weeks of aggregate reports, fix every legitimate sender that fails, then quarantine, then reject. Newsletters, CRMs, invoicing tools and website contact forms are the usual surprises. We moved quickly because we know every system that sends as our domain and both signatures align, and we are reading the first reports closely in case we need to roll back. This is exactly the kind of work Sendmarc does for organisations with dozens of senders.

The last three points: BIMI and certificates

After these changes the scan came back at 97: Impersonation 5 out of 5, Privacy 5 out of 5, Branding 2 out of 5. Our BIMI record and SVG logo are valid, but Gmail and Apple Mail only show the logo when the record points at a Verified Mark Certificate or Common Mark Certificate from an approved issuer. A VMC needs a registered trademark; a CMC needs proof the logo has been in public use for a year. Both are paid and renewed annually, so for now we are proudly sitting at 97.

Takeaway

Self-hosted mail can score as well as the big providers. Publish MTA-STS and TLS-RPT, make sure your report addresses actually receive mail, confirm every sender signs with an aligned DKIM key, then move DMARC to reject. And if the Sendmarc team is at an event near you, go and say hello. You will learn a lot, and there might be chocolate.

SOURCES

  1. Sendmarc: DMARC and email security — Sendmarc
  2. mailcow: dockerized open-source mail server — mailcow
  3. RFC 7489: Domain-based Message Authentication, Reporting, and Conformance (DMARC) — RFC Editor
  4. RFC 7208: Sender Policy Framework (SPF) — RFC Editor
  5. RFC 6376: DomainKeys Identified Mail (DKIM) Signatures — RFC Editor
  6. RFC 8461: SMTP MTA Strict Transport Security (MTA-STS) — RFC Editor
  7. RFC 8460: SMTP TLS Reporting — RFC Editor
  8. BIMI Group: Brand Indicators for Message Identification — BIMI Group

Frequently asked questions

Do I need both SPF and DKIM to pass DMARC?

No. DMARC passes when either SPF or DKIM passes and aligns with the domain in the From header. Aligned DKIM is the more robust of the two, because it survives relays and forwarding.

Why am I not receiving DMARC reports?

Check that the address in your rua tag actually exists and accepts mail. In our case the mailbox had never been created, and every report was rejected with 550 User unknown.

What is the difference between MTA-STS testing and enforce?

In testing mode, senders deliver as normal and only report TLS problems through TLS-RPT. In enforce mode, they refuse to deliver over a connection without valid TLS to a listed MX.

Can I show my logo in Gmail with BIMI without a certificate?

Not in Gmail or Apple Mail. They require a Verified Mark Certificate or, for Gmail, a Common Mark Certificate from an approved issuer, although a certificate-free BIMI record is still valid.

NEWSLETTER

Get the engineering notes in your inbox.

Kernels, GPUs, networks, AI infrastructure — and the things we broke along the way. No spam, one click to leave.

We store only your email address, to send you new articles. See our privacy policy.

TAGS

DMARCMTA-STSTLS-RPTMailcowEmail SecurityBIMI

RELATED

ENGINEERING NOTES

Things we built.Things we broke.Things we learned.