Question
How-To test email filters?
Answer
When using filters, you might have issues receiving email depending on how your filters were configured. Identifying which rule caused the problem might be challenging if you have many of them. Fortunately, cPanel has a feature that can help you find the cause.
Account Level Email Filters
- Login to the cPanel account
- Click on the Email Filters icon
- Click on the Manage Filters link to the right of your email account
- Under your existing filters will be a section labeled Filter Test
- Enter a test message that contains the specifics you want to test
- Click the blue Test Filter button
Global Email Filters
- Login to the cPanel account
- Click on the Global Email Filters icon
- Under your existing filters will be a section labeled Filter Test
- Enter a test message that contains the specifics you want to test
- Click the blue Test Filter button
Email Filter Test Results
CONFIG_TEXT: Sub-condition is false: not first_delivery<br>
Condition is false: not first_delivery and error_message<br>
Condition is true: $header_from: contains localhost<br>
Return-path copied from sender<br>
Sender = test@localhost<br>
Recipient = test@cptest.tld<br>
Testing Exim filter file "/etc/vfilters/cptest.tld"<br>
Headers charset "UTF-8"<br>
Save message to: /dev/null 0660<br>
Filtering set up at least one significant delivery or other action.<br>
No other deliveries will occur.
- Login to the server as the root user via SSH or use the WHM Terminal.
Create a text file that contains the email message to test against your filters. Let's imagine that this file exists at:
/home/mydom/mail/path-to-the-email-you-want-to-testCONFIG_TEXT: To: test@cptest.tld
From: cpanelnoreply@gmail.com
Subject: Test Message
This is a test message.Use the following command to test an Account Level email filter for the test@cptest.tld account. Be sure to update the command to match your account's filter, test message files.
# exim -d-all+filter -bf /home/cptest/etc/cptest.tld/test/filter </home/mydom/mail/path-to-the-email-you-want-to-test
Use the following command to test the Global Email Filter for a domain. Be sure to replace the path to your domain's vfilters file, and the path to your test message:
# exim -d-all+filter -bf /etc/vfilters/cptest.tld </home/mydom/mail/path-to-the-email-you-want-to-test
To test the system filter for the entire server, use the following:
# exim -d-all+filter -bf /etc/cpanel_exim_system_filter </home/mydom/mail/path-to-the-email-you-want-to-test
Note: Please note that instead of a new text file, you can use an actual email file from your inbox as the test message.
Comments
0 comments
Article is closed for comments.