Adding Regular Expressions to Spam Filter
To block emails based on their content or subject using regular expressions (regex), you can add these regex patterns to custom_subject_content.map for subject filtering and custom_regex_content.map for content filtering. Below are the steps to achieve this via the Rspamd Web UI.
Accessing Rspamd Web UI
- Log into the Rspamd Web UI:
- Navigate to the Server Status section.
- Click on the RSPAMD UI button.
Editing the Custom Maps
Navigate to Configuration: - Once in the Rspamd Web UI, go to the Configuration section from the navigation menu. - Locate the Lists section.
Edit
custom_subject_content.maporcustom_regex_content.map: - Find and selectcustom_subject_content.mapto edit subject filters. - Find and selectcustom_regex_content.mapto edit content filters.Add Regular Expressions: - Each regex pattern should be on a new line. - The regex must start and end with a
/and include appropriate parameters (e.g.,ifor case-insensitive,ufor Unicode). - Save changes after adding your regex patterns.
Example Regular Expressions
To block emails with specific words or patterns in the subject, add patterns to custom_subject_content.map. For example:
/Free Money/i
/PenÃze zadarmo/iu
/Win a Prize/iu
For more information about blocking spam, see the RSPAMd manual, especially the multimap module.