I use firefox/mozilla relay as a service to generate email addresses for websites that I do not want to give my actual email to, Stalwart classifies all of these received as spam due to SPOOF_REPLYTO and SPOOF_DISPLAYNAME.
I would like to modify these tags to 0 score if they come from *.mozmail.com/mozmail.com, I am unsure of how to go about this. I’ve tried a sieve rule but that did not seem to work, and I do not want to allow anything from mozmail.com as not spam, as it is still possibly it could relay actual spam.
Is there a way to tweak the spam filters more granularly?
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.
You can’t turn SPOOF_REPLYTO/SPOOF_DISPLAYNAME off outright for a specific domain (they come from Stalwart’s built-in reply-to/phishing analysis, not a toggleable STWT_ core rule), but you can neutralise their score specifically for mozmail.com senders by adding a custom rule that assigns an offsetting negative-score tag.
The approach:
Create a custom SpamRule (WebUI: Settings › Spam Filter › Rules) using the Domain or Email variant, with a condition that checks whether the sender’s domain is mozmail.com or a subdomain of it, e.g. something like:
This way, mail from mozmail.com still runs through the normal spoof checks (so you’re not whitelisting the domain outright), but the cumulative score for genuine relay mail is pulled back down, while non-mozmail spoofed mail is unaffected. You can tune the negative value to offset only SPOOF_REPLYTO/SPOOF_DISPLAYNAME rather than all scoring, by checking current per-tag scores under Scores and matching the magnitude.
See the Rules and Scores documentation for the full condition/expression syntax and available sender variables.
This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.
I’ve tried this as is, and with different ifs such as domain == 'mozmail.com' sld == 'mozmail.com' env_from.domain == 'mozmail.com', from.domain == 'mozmail.com' none of them seem to apply the MOZMAIL_SENDER rule
For the next change you make: you don’t need a full restart. Run the Reload Settings action from Management > Actions (or stalwart-cli create Action/ReloadSettings) and the rules are recompiled in place. Overview | Stalwart