Hello,
My customers have been receiving a large number of emails from different senders, all with the following subject:
YOU GOT RECORDED!
To also block slight variations of this subject, I created the following regular expression, based on the syntax recommended by Rspamd:
$$
/\s(?: (?:RE|FW|FWD|TR|RV)\s:\s)YOU\s+GOT\s+RECORDED[\s.!?:;,_-]*$/iu
$$
This expression allows us to:
Ignore differences between uppercase and lowercase letters;
Accept additional whitespace;
Recognise prefixes such as RE:, FW:, FWD:, TR:, or RV:;
Accept slight variations in punctuation at the end;
Correctly process Unicode characters.
However, when I add this expression under:
Tools & Utilities > Spam AutoShield Tools > Block / Unblock Spam Subject
cPFence automatically converts it to:
$$
//\s(?: (?:RE|FW|FWD|TR|RV)\s:\s)YOU\s+GOT\s+RECORDED[\s.!?:;,_-]*$/iu/i
$$
In other words, the system adds the delimiters and the /i modifier again, making the expression invalid.
For administrators managing only one mail server, adding the rule manually to the Rspamd configuration is not a major issue. However, this cPFence feature is particularly useful for those managing several mail servers.
I normally already have the relevant servers selected and use:
Tools & Utilities > Spam AutoShield Tools > Block / Unblock Spam Subject
This allows me to send and apply the same rule to all selected servers simultaneously, without having to access each server individually and manually edit its configuration.
Would it be possible to improve this functionality so that the system checks whether the submitted value is already a complete regular expression?
For example:
If it starts with /^ and ends with /i, /u, /iu, or another valid modifier, save the expression without changing it;
If only plain text is entered, continue generating the regular expression automatically;
Alternatively, provide an option to specify whether the submitted content is plain text or a regular expression.
For reference:
/i — ignores differences between uppercase and lowercase letters;
/u — processes the content as UTF-8/Unicode;
/iu — enables both behaviours.
This improvement would make it possible to create more flexible and effective rules directly through Spam AutoShield and distribute them easily across multiple servers, without complete regular expressions being modified or rendered invalid by the system.
Thank you.
Note: I intentionally added a space between : and ( in the character class above to prevent the forum from automatically converting : ( into a smiley. The actual regular expression does not contain this space: