Add a domain(s) to DNSWL

Your question

Hello!
I am trying to add a domain to the DNSWL. I receive a lot of emails from two specific domains and the spam filters think it’s spam. Which is correct, they would be spam except they are from two specific domains and I would like them to land in the Inbox bypassing the spam filter. The username changes, only the sender’s domains remain constant.
Is this possible? How can I do it?
Thanks a lot!

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

You can do this with a custom expression on the spam filter trigger, using the sender’s envelope domain. Stalwart controls whether the spam filter runs at all via enableSpamFilter on the MtaStageData object (WebUI: Settings → MTA → Session → DATA Stage). You can set it to skip filtering entirely for your two trusted domains:

{
  "enableSpamFilter": {
    "match": [
      {"if": "contains(['trusted-domain1.com', 'trusted-domain2.com'], env_from.domain)", "then": "false"}
    ],
    "else": "true"
  }
}

env_from.domain is the domain part of the envelope sender (MAIL FROM), so any address [email protected] will bypass the spam filter regardless of the local part, landing straight in the Inbox.

If you’d rather keep spam scoring active for other checks and only stop DNS block-list rejections for these domains, you can instead add them to the trusted-domains namespace of the in-memory lookup lists (WebUI: Settings → Spam Filter → Lists → Trusted Domains), though that only bypasses DNSBL checks, not the full spam score.

Docs: DATA stage | Stalwart and https://stalw.art/docs/spamfilter/settings/domain_lists

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Thanks! Sorry for my ignorance, could you be more specific where I should insert that script? Should I substitute the default “is_empty(authenticated_as)” in the Spam Filtering field? And should I write anything in the Run Script field?

dnswl.org is somebody else’s list. We query it, but you cannot put entries into it. What you want is the local equivalent, the trusted-domains list, under Settings, Spam Filter, Lists, Trusted Domains. Add the two domains there, then run Actions, Reload, Lookup stores, which is a different action from the server settings reload and the one that picks up list changes.

DNSBL checks are then skipped entirely for those domains, and messages from them pick up a -7.0 adjustment against a spam threshold of 5.0, which in practice is decisive. The adjustment is conditional on the sender’s DMARC passing, so it works for domains that publish a policy and authenticate properly, which most legitimate senders now do.

To your actual question, since the answer you got was hard to map onto the UI: yes, “Spam Filtering” is the field with is_empty(authenticated_as) in it, and that is where a hard bypass would go. “Run Script” is unrelated, it takes a Sieve script. If you do use the Spam Filtering field, the variable there is sender_domain and not env_from.domain, which only exists in spam filter expressions and will be rejected.

The list is the better of the two, though. Turning the filter off for a sender means no scanning at all, no headers, nothing learned, and it trusts an envelope sender that anyone can forge. The list keeps the message scanned and gates the trust on DMARC.

Thank you, very clear answer!