global filter that forwards and keeps local copies?

rvdb

Registered
Sep 21, 2017
2
0
1
computer
cPanel Access Level
Root Administrator
I am trying to find a mechanism in cPanel that:
  1. detects all mails sent from a specific domain (e.g. domain.toforward) to any email account on my domain (e.g. [email protected], [email protected], ...)
  2. forwards those messages to a specific email account on my domain (e.g. [email protected])
  3. also keeps a copy of the message in the original inbox
Both [1] and [2] work well with a global filter that redirects emails sent from "@domain.toforward" to "[email protected]".

Yet, this redirection does not keep a copy of the message in the inbox of the account it was sent to originally (e.g. [email protected]). Adding a second (or first) action to the filter which delivers the message to a specific folder comes close, but this seems only possible to specific folders. Is there perhaps a variable that can be used in the folder path which resolves to the specific account that has received the original message, e.g.:
Code:
/${domain}/${local_part}
?

I've tried these variables from the exim documentation, but cPanel doesn't allow to store this path for a "deliver to folder" action :
Filter destination paths cannot contain mailboxes that start with the “~” character or contain the following characters: “@”, “$”, “"”, and “\0”
Or am I missing anything obvious, and is there a better way to set up a global filter that forwards and keeps local copies?

Hm, I can't edit my original post, but I'd like to state that I'm using cPanel version 66.0.23. I do have SSH access to the server but am on a limited end-user account, so I probably don't have access to all configuration files.
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,245
463
Hello,

You won't be able to use those variables using the "Deliver to Folder" action with cPanel access only. However, one alternative would be to setup individual filter rules for each specific email account so that you can save the copy of the message to the individual INBOX folder for each email account. Or, you could reach out to your hosting provider to see if they could setup a rule using the Exim system filter file.

Thank you.
 

rvdb

Registered
Sep 21, 2017
2
0
1
computer
cPanel Access Level
Root Administrator
Thanks for your reply.

I've realized, however, that I can access a filter file through the cPanel "Email Forwarders and Filters" backup, so could this perhaps provide a more advanced way of editing filter rules (download filters, update filter file locally, upload again)?

Is it possible make use of variables in that downloaded filter file itself, or to otherwise add a rule that also keeps a local copy in the receiving email account before redirecting?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,245
463
Hello,

I believe you'd face the same error message when restoring a filter file with that type of variable that you would when editing a filter. You are welcome to try it, however you may want to instead consider opening a feature request for this functionality via:

Submit A Feature Request

Thank you.