Exim filter for failed dkim or not in acceptable domain list


Well-Known Member
Jun 5, 2016
new york
cPanel Access Level
Root Administrator
I wish to create an exim filter (newby here and afraid of touching exim file but will give it a try) which will apply the following rules in the following order:

1st check) If inbound message not on acceptable domain list dump message into bad-domain folder in user's Roundcube Webmail account.


2nd. check) If dkim failed dump message into dkim-failed folder in user's Roundcube Webmail folder.

I see that I can use CPanel account level filtering, but there is no dictionary available that defines these different cases (values) - as well, the sketchy documentation does not state if it searches ALL headers for matches or just the basics like from, to, subject, etc.

Thank you.


Staff member
Apr 11, 2011

The following document is a good place to start when setting up filters:

How to Configure Mail Filters - cPanel Knowledge Base - cPanel Documentation

That said, it looks like you are seeking filter rules that are outside the standard behavior (e.g. scanning files for a domain match, creating custom email folders for individual email accounts). These types of rules are unsupported, but you may find some of the examples of the following thread helpful as proof-of-concept:

Need to filter ALL email

Or, consider setting up custom SpamAssassin rules instead so you can simply have messages meeting that criteria marked as SPAM (this would allow you to use the native SPAM folder feature and avoid having to develop custom filter rules that create mail folders).

Note that for DKIM checking, you'd need to make sure the "Allow DKIM verification for incoming messages" option is enabled under the "ACL Options" tab in "WHM >> Exim Configuration Manager >> Basic Editor".

Thank you.