Email Filters based on attachment

Oct 7, 2022
19
0
1
Uddevalla
cPanel Access Level
Root Administrator
Is there a way to filter emails based on the name of their attachment or the content in an attachment?

I would like to filter out emails that have an attachment with the name that contains X or, if they have X in the text in the attachment.

Preferably without any coding, perhaps a plugin?
 

techAMIGO

Well-Known Member
Nov 6, 2019
68
48
18
Kerala, india
cPanel Access Level
Root Administrator
Hello Carl-Johan Larsson,

As of cPanel's last knowledge update regarding email Filters, in September 2021 & July 2022, cPanel itself doesn't offer built-in features for filtering emails based on the content on attachments.

Email Filters

Configure Email Filters

Other than that, you can create a custom filter rule file, this might would be helpful for you.

Customize the Exim System Filter File


There is no direct "has attachment" filter option, however there will be information in the headers that might get the attachment's name filter job done. Try it.

1. This would catch every email with any type of attachment. But be warned, that includes signature images and a host of other benign files. The better option is to filter out specific types of attachments.

Body - Contains
Content-Disposition: attachment;


2. Would catch anything with a .zip file attachment.

Body - Contains
Content-Type: application/zip;

OR
Body - Contains
Content-Disposition: attachment;

AND
Body - Contains
.zip
 
Last edited: