Knowledge Base
Creating an advanced (regex) rule in MXFilter
Advanced rules match a regular expression against the subject, body, a header, the sending IP or the HELO name. This example blocks prize scams by their subject line.
- Open MXFilter, see Logging in to MXFilter, go to Filter Rules and click Advanced Rule.
- Fill in the form:
- Rule Name: letters and numbers only, spaces become underscores, for example
BLOCK_PRIZE_SCAMS. - Description: what the rule is for.
- Match Type: where to look. Choose Subject for this example.
- Flags:
iignores upper and lower case. - Regular Expression: for example
(you'?ve|you have) won|free cruise
- Rule Name: letters and numbers only, spaces become underscores, for example
- Paste a sample subject into Test String. Matches are highlighted in yellow. Test before you save.
- Choose an Action, keep Enabled ticked and click Save.
The rule appears in the list with an ADV label.
Actions
- Reject: refused, and the sender gets a bounce.
- Soft Reject (Hold): held in quarantine for review.
- Add Header: delivered with an extra header so your mail app can filter it.
- No Action (Whitelist): let through. Use this to rescue mail that is caught wrongly.
What a rule can match
Subject, From domain, From address, Recipient, a custom header, the message body, the sender IP and the HELO/EHLO name.
Troubleshooting
- Nothing is highlighted in the test box: the pattern does not match. Check for typos, add the
iflag, or simplify the pattern. - Genuine mail is caught: make the pattern more specific. For example
\bwon\bmatches the word "won" but not "wonderful". Soft Reject mail can be released from quarantine, but rejected mail cannot be recovered. - To turn a rule off: edit it and untick Enabled, or delete it.