Creating global email filter via command line
Hi,
I am trying to create an email filter with UAPI via the command line. I use:
uapi --user=myusername Email store_filter account=spampro1234@spamprotection.com filtername=TestFilter action=deliver dest=destination@email.com match=contains part=$header_from: val=from@email.com
which should take any email from from@email.com[/EMAIL] that is sent to spampro1234@spamprotection.com and forward it to destination@email.com[/EMAIL]
I get this output though:
---
apiversion: 3
func: store_filter
module: Email
result:
data: ~
errors:
- No valid rules.
messages: ~
metadata: {}
status: 0
Can anyone see what I am doing wrong?
Thank you.
-
Hello, You must URI-encode values when using this UAPI function: Percent-encoding - Wikipedia, the free encyclopedia There are third-party conversion tools you can find on a search engine if necessary. In addition, you may want to use the API Shell option in cPanel when testing the function: API Shell for cPanel - Documentation - cPanel Documentation You must enable it as a feature on the feature list associated with the package assigned to the account, and ensure the cPanel account is a reseller in order to use this feature. Thank you. 0 -
Hi, I have tried encoding just the values, essentially just the @ in the emails and the $ and : in header_from, and everything, and some things, but I cannot make it work. Is there not an example of a properly formatted uapi call somewhere I can look at? It is not an option to make the accounts re sellers unfortunately. uapi --user=myusername Email store_filter account=spampro1234%40spamprotection.com filtername=TestFilter action=deliver dest=destination%40email.com match=contains part=%24header_from%3A val=from%40email.com EDIT: I actually made it work, I HAD TO add a 1 behind action, dest, part, match and val. I had to escape the header value like this: \$header_from: I could NOT URI encode the email addresses, I HAD TO use @ otherwise it just said it was an invalid email address. 0 -
Hello, Thank you for taking the time to report this issue. Our documentation is now updated to reflect this: UAPI Functions - Email::store_filter - Software Development Kit - cPanel Documentation Could you let us know if you notice any more issues with the examples provided? Thank you. 0
Please sign in to leave a comment.
Comments
3 comments