Skip to content

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.


  1. Open MXFilter, see Logging in to MXFilter, go to Filter Rules and click Advanced Rule.
  2. 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: i ignores upper and lower case.
    • Regular Expression: for example (you'?ve|you have) won|free cruise
  3. Paste a sample subject into Test String. Matches are highlighted in yellow. Test before you save.
  4. 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 i flag, or simplify the pattern.
  • Genuine mail is caught: make the pattern more specific. For example \bwon\b matches 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.
Please rate this article to help us improve our Knowledge Base.

0 0