How to Create Mail Filter Rules For Mailing Lists

Last modified: October 15, 2024


Overview

This document explains how to create mail filter rules in cPanel’s Mailing Lists interface (cPanel » Home » Email » Mailing Lists). Mail filters allow you to control which email messages your server delivers.

Create a mail filter rule

Important:
  • Mailman’s Spam Filters feature requires that you enable spam filters. To enable Apache SpamAssassin™ for your cPanel account, select Enable Apache SpamAssassin in cPanel’s Spam Filters interface (cPanel » Home » Email » Spam Filters).
  • Generally, the recipient does not receive the BCC field in an email’s header. For this reason, you cannot use the BCC field in a filter.

To control which email messages your server delivers to your mailing lists, use Mailman’s Spam filters interface. To create a mail filter rule with the Header filters section of the Spam filters interface, perform the following steps:

  1. Access Mailman’s Spam filters interface. To do this, perform the follow steps:

  2. Navigate to cPanel’s Mailing Lists interface (cPanel » Home » Email » Mailing Lists).

  3. Click Manage for the mailing list that you wish to edit. A new interface will appear.

  4. In the Configuration Categories section at the top, click Privacy options.

  5. Click Spam filters.

  6. In the Spam Filter Rule 1 text box, enter a regular expression (regex) that matches the messages to which to apply an action. For example:

X-Spam-Status:\+{5,}+Yes
Notes:
  • This example filter applies to any message that SpamAssassin scores 5 or higher. Filters that require lower scores will mark more emails as spam, because those emails have to meet fewer requirements to qualify as spam.
  • Individual users generally use 5 as a spam score, while ISPs can use a higher score to prevent filtering out non-spam emails.
  • The + character here corresponds to the * character.
  • Apache SpamAssassin adds information to the header of each mail message that it reviews. You can use this information to determine which mail filter rules to use.
  1. Next to Action:, select the action for Mailman to perform on the messages that match the filter. You can select the following settings:

    • Defer — Disable the filter rule.
    • Hold — Hold the messages that match the filter rule until a moderator approves it.
    • Reject — Reject the messages that match the filter rule.
    • Discard — Delete the messages that match the filter rule.
    • Accept — Accept the messages that match the filter rule.
  2. Click Submit Your Changes.

Legacy anti-spam filters

Note:

A moderator of the mailing list must approve the messages that match any spam filters in the Legacy anti-spam filters section of the Spam filters interface.

To create a mail filter rule with the Legacy anti-spam filters section of Apache SpamAssassin’s Spam filters interface, perform the following steps:

  1. In the Legacy anti-spam filters text box, enter the header information to filter.
  2. Click Submit Your Changes.

Additional Documentation