How to filter incoming e-mail messages by IP address

This article describes the way to use cPanel's e-mail filtering capabilities to process incoming messages from a selected IP address or range of IP addresses. For instance, you can want to automatically delete all incoming messages from an IP address.

You can enable filtering for a specific user, or for all users on your account.

Determining which IP address to filter

All e-mail messages contain in their headers information about their origin. By examining the message headers, you’ll determine which IP address or addresses you want to filter.

For information about the way to view e-mail message headers for your e-mail client. In the raw e-mail message headers, search for the IP address that you want to filter. The IP address is often in the Received: header.

 

Setting up the e-mail filter

 

After you know which IP address or addresses you want to filter, you’re ready to set up filters in cPanel. To do this, follow these steps:

1. Log in to cPanel.

2. Select one of the following:

  • If you would like to filter messages by IP address for all of your e-mail accounts, in the EMAIL section of the cPanel home screen, click Global Email Filters:

       

  • If you would like to filter messages by IP address for a selected e-mail account, in the EMAIL section of the cPanel home screen, click Email Filters:

       

  • Locate the account for which you want to add a filter, then click Manage Filters.

3. Click Create a New Filter.

4. In the Filter Name text box, type a name for the filter.

5. Under Rules, in the From the list box, select Any header.

6. In the contains list box, select matches regex.

7. In the next text box, type the following regular (also known simply as a “regex”). Replace xxx with the digits of the specific IP address you want to filter:

 



Alternatively, you’ll filter a range of IP addresses. For instance, the following regular expression matches the last 256 addresses in the network:

 



"A range of IP addresses is a collection defined by a starting address and ending address. For instance, the range of IP addresses from 10.4.1.1 to 10.4.1.75 includes 75 total addresses."

"Make sure that the regular expression isn’t too broad. Otherwise, you’ll unintentionally filter messages that you want to receive. To test your regular expression interactively and confirm it matches what it’s supposed to match."

8. Under Actions, select what to do with messages that match the filter. For instance, you’ll discard the message, send it to a selected folder, redirect it, and other actions.

9. Click Create. cPanel creates the new filter, which takes effect immediately.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I change a database password on cPanel?

Changing MySQL database password via cPanel You can change your database’s password by...

How can I change my PHP version on cPanel?

Changing PHP version via cPanel Your Hosting Account's PHP version can be changed at any time,...

How can I create a new MySQL database in cPanel?

Creating a new MySQL database at Servers GATE using cPanel   You can easily create a new MySQL...

How can I locate my MySQL database details on cPanel?

Locating your MySQL database details via cPanel You can easily locate your MySQL databases...

How can I set up a redirect on cPanel?

Creating a redirect on cPanel Your hosting redirects can be easily managed with the assistance...