How To Filter Incoming Email Messages By IP Address In cPanel

In this article, we will describe how to use email filtering by IP address in cPanel. To filter incoming messages from a specific IP address or range of IP addresses. For example, you may want to automatically delete all incoming messages from an IP address. Also you can enable filtering for a specific user, or for all users on your account.

Specify The IP Address To Filter

All incoming emails come with header information, that includes the IP address of their original server.

When you are viewing the message source, you can determine the IP by simply look at the receive and from. The IP addresses (also called IPv4 addresses) will be in this format: xxx.xxx.xxx.xxx (e.g. 256.256.256.256). In the future, you may see addresses in a new format IPv6, but for now, emails are still using the older format.

How To Set Up An Email Filtering By IP Address

  • Login to cPanel.
  • Navigate to the Mail section, and select one of the following:
    • Click Global Email Filters. (if you want to filter messages by IP address for all of your email accounts).
    • Or click Email Filters. (If you want to filter messages by IP address for a specific email account).
  • Locate the account for which you want to add a filter. After that, click Manage Filters.
  • Then click Create a New Filter.
  • Type a name for the filter, in the Filter Name text box.
  • Under Rules, in the From list box, select Any header.
  • In the contains list box, select matches regex.
  • Type the following regular expression (also known simply as a “regex”), In the next text box. Then replace xxx with the digits of the specific IP address you want to filter.
  • Under Actions, select what to do with messages that match the filter. For example, you can discard the message, send it to a specific folder, redirect it, and other actions.
  • Finally, click create.
Filtering by IP Address

Visit our Manage Emails section for more information about managing emails in cPanel.

Share Article

Related Articles