Setting up server-side filter rules with CPanel/IMAP
So, go into CPanel -> Email Management -> Email filtering.
Add Filter.
Add your criteria and in the Destination, enter the absolute path to the folder that you want the email placed in. This is slightly tricky to figure out if you don't have shell access. On my server it was /home/[CPanel username]/mail/[domain.name]/[mail username]/[folder name].
That's it! No more setting client-side mail filters!
The Setting up server-side filter rules with CPanel/IMAP article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.

Subscribe to my blog






Roy Low
I am trying to filter using cpanel in a more complex way than the usual simple example such as “If Header contains “foo” then forward to me {at} mydomain(.)net”
I would like to make a .filter file to do something like:
If $header_to contains “foo” AND $message_body contains “icecream” then forward to me {at} mydomain(.)net
Of course this synyax doesn’t work.
Exim seems to know about “and”, “or”, then” etc but I can’t get the syntax right
Please help somebody!
May 18th, 2006 at 9:07 amTuttle
Does this still work? I used to do this when our cPanel server still used mbox mail storage format.
/home/[CPanel username]/mail/[domain.name]/[mail username]/[folder name]
However, now our cPanel server has converted to maildir mail storage format. Now within a mail account each folder name begins with a period, e.g. for mail username Bob containing a sub-folder Work, it looks like this:
home/[CPanel username]/mail/[domain.name]/Bob/.Work
But, I tried setting the new path in the cPanel filters, adding the new period in front of the folder name, but it isn’t working. The mail that matches the filter patter just disappears and does not go to that folder.
Something must be different with maildir for specifying pathnames.
November 17th, 2006 at 11:54 pmJason
Hello,
I want to disable perticular subject line for all the sites on my server not for perticular doamin so that no one can send an email with that header.
December 8th, 2006 at 12:07 amHow can I do that.. please advise.
Thank you.
http://windows-tweaks.blogspor.com
Adam C.
I’m having a similar problem as Tuttle - any new work arounds?
November 29th, 2007 at 8:31 pmSimon
Thanks for the pointer. This has evolved in cPanel 11, to the extent that I can manage filters on a user level from the cPanel screen, and define which folder to move it to purely by name, e.g. ‘Receipts’.
May 25th, 2008 at 1:28 pm