Configuration
You’ll find the settings in the back end under System → Settings → Anti-SPAM. Without any changes the bundle works with sensible defaults.
| Setting | Description |
|---|---|
| Disable Anti-SPAM | Turns off the check for all forms. |
| Grey zone threshold | From this score on, a submission is considered suspicious. Default: 5 |
| Spam threshold | From this score on, the submission is silently discarded. Default: 10 |
| Grey zone action | Don’t send, show notice (default) or Send, mark subject with “[SPAM?]” |
| Notice text | Shown above the submit button in the grey zone. Insert tags such as {{email::info@example.com}} are allowed. Empty = default text. |
| Custom rules | Regex rules with points, see below. |
Decision
| Score | Result |
|---|---|
| below the grey zone (default < 5) | processed normally |
| grey zone (default 5–9) | depending on the setting: show the notice and don’t send, or send with “[SPAM?]” in the subject |
| spam (default ≥ 10) | silently discarded; redirect to the same page, so it looks like a success to bots |
If the grey zone threshold is higher than the spam threshold, it is automatically lowered to the spam threshold.
Use a custom notice text with your e-mail address or phone number so that wrongly blocked prospects can still reach you.
Custom rules
Each rule consists of:
| Column | Description |
|---|---|
| Field name | Name of the form field, e.g. message, or * for all fields |
| Regex pattern | PHP regex including delimiters, e.g. /viagra|casino/i |
| Points | Score points on a match |
Invalid patterns are rejected on save, incomplete rows are ignored. Limits apply to protect against expensive patterns, see Checks. On Contao 4.13 and 5.3 this requires the MultiColumnWizard (see Requirements).
Both widgets store the same structure, so existing rules should survive an update from Contao 5.3 to 5.7 (not tested in the browser).
Configuration via config.yaml
Like all Contao settings, the values are stored in system/config/localconfig.php – not in the database. If this
file is read-only (e.g. deployments without a writable file system), nothing can be saved in the back end. This
affects all Contao settings, not just this bundle.
For such installations, set the values in config/config.yaml (works in Contao 4.13 to 6.x):
- Values from
config.yamloverride the back-end settings. Contao automatically locks the affected fields in the back end and marks them with an info icon. - Regex patterns set here are not validated on save. Invalid patterns are skipped at runtime and reported as a warning in the Contao system log at most once per day.
- Clear the cache after changes:
vendor/bin/contao-console cache:clear
System log
Suspicious submissions are logged in the Contao system log – with form, score, decision and reasons, but without form contents. Entries appear in the language of the page the form was submitted on. Use them to fine-tune the thresholds based on real submissions.