Creating custom rules for spam control in Kerio Connect

In Kerio Connect, you can create your own antispam rules. The rules filter email headers or email bodies.

To create custom rules for spam control, go to Configuration > Content Filter > Spam Filter > Custom rules.

Creating custom rules

You can create as many rules as you like.

Kerio Connect processes the rules in the order they are listed. If the spam filter marks a messages as non-spam or rejects it, Kerio Connect stops processing the remaining rules.

  1. In the administration interface, go to Configuration > Content Filter > Spam Filter > Custom rules.
  2. Click Add.
  3. In the Add Rule dialog, type a name for the rule.
  4. Select Mail header or Mail body filter.
  5. Type the string you want to filter. You can use:
  • Any text
  • * to represent any number of characters
  • ? to represent a single character
  • Regular expressions (mail body only)
  1. For any message that matches the rule, you can:
  • Treat the message as non-spam
  • Treat the message as spam and reject it
  • Add spam score to the message
  1. Click OK.


To decrease the load on your server, place the From and To header rules at the top. If Kerio Connect rejects messages using this rule, no other antispam or antivirus tests are performed on these messages.

Example for regular expressions

You want to block all messages that contain the word cialis.

Use regular expressions to exclude words containing the substring cialis, such as specialist, socialist.

  1. In Configuration > Content Filter > Spam Filter > Custom rules, click Add.
  2. Select Mail body and type the following regular expressionEnables to define a sequence of characters that specify a search pattern.: /\bcialis\b/i
  3. Select Treat the message as spam and reject it.
  4. Click OK.

From now on, Kerio Connect rejects all messages that include cialis as a single word.

For detailed information on regular expressions, see the SpamAssassin wiki page.



Regular expressions combined with * and ? wildcards do not work with contains substring (see the screenshot below).


Defining actions for custom rules

If your custom rule rejects a message, Kerio Connect can:

  • Send a bounce message to the sender — We do not recommend this option because spammers usually fake addresses, so your bounce message will be undeliverable.
  • Forward the message to a quarantine address — We recommend this option so that important messages are not falsely identified as spam.

You can select these option in Configuration > Content Filter > Spam Filter > Custom rules under the list of your custom rules.


To decrease the load on the server, Kerio Connect can reject messages during the SMTPSimple Mail Transport Protocol - An internet standard used for email transmission across IP networks. session.

To enable rejection during the SMTP session, select Reject messages as soon as possible....

However, Kerio Connect cannot now perform the two actions described above.