UAPI Email store filter duplicates folder destination
Just discovered UAPI Functions - Email::store_filter for mass-adding email filters. Thankful that this exists!
Unfortunately my first test had a problem. I'm creating a filter that basically whitelists an email by check the header_from for this email and delivering it to the inbox of this account. Here's my URL test (anonymized a bit):
The return in the browser was:
the save line of the resulting filter was:
This is the destination folder twice. If I go into the online interface and simply select INBOX and save it. Then when I look at the resulting filter it shows:
So, for some reason the destination folder is getting doubled. It seems like this would be the ideal solution but this is a significant issue. Also, I'm just a normal customer at this hosting company. I don't have any system-level access other than SSH into my own account with cagefs so I can't change their cPanel installation. Anybody else run into this or have an idea of what I can/should do? Thanks!
https://myhostingcompany.com:2083/cpsess3485885060/execute/Email/store_filter?filtername=abc123%40gmail.com&account=account123%40mydomain.com&action1=save&dest1=%24home%2Fmail%2Fmydomain.com%2Faccount123%2F&part1=%24header_from%3A&match1=contains&val1=abc123%40gmail.comThe return in the browser was:
{"metadata":{},"data":{"account":"account123@mydomain.com"},"errors":null,"warnings":null,"messages":null,"status":1}the save line of the resulting filter was:
save "$home/mail/mydomain.com/account123/$home/mail/mydomain.com/account123/" 660This is the destination folder twice. If I go into the online interface and simply select INBOX and save it. Then when I look at the resulting filter it shows:
save "$home/mail/mydomain.com/account123/" 660So, for some reason the destination folder is getting doubled. It seems like this would be the ideal solution but this is a significant issue. Also, I'm just a normal customer at this hosting company. I don't have any system-level access other than SSH into my own account with cagefs so I can't change their cPanel installation. Anybody else run into this or have an idea of what I can/should do? Thanks!
-
I'm not able to replicate this when the data is entered in correctly. Here is what I did: uapi --user=myuser Email store_filter filtername=somename account=lauren%40mydomain.tld action1=save dest1=%2Fhome%2Fmyuser%2Fmail%2Fmydomaint.tld%2Flauren%2F part1=\$header_subject: match1=contains val1=anything
This resulted in the following filter being added:#somename if $header_subject: contains "anything" then save "$home/mail/mydomain.tld/lauren/" 660 endif
I noticed in your example you're entering some paths in incorrectly. For example the dest1 path should be/home/$user/mail/domain.tld/emailuser/
not/home/mail/domain.tld/emailuser/
also, note that I only URI encoded values which were encoded in the example.0 -
Thanks for your reply and insight. Changing my destination to match your example worked.:) What I HAD done was to simply URL encode what's in the filter file for the "save" destination. This does NOT contain the user id but I had not understood $home properly as something that is expanded to "home/$user". Having such an example in the help would be REALLY nice for those of us who don't play in the Linux shell all the time. (not really sure where to leave such feedback). Anyway thanks again for the help! 0 -
This is the right place for it! I'll make sure the team that does the documentation on this is aware. I do know they are attempting to make changes and revamp that documentation with the end-user and the developer in mind so it helps both types of users 0 -
Great. Thanks! 0
Please sign in to leave a comment.
Comments
4 comments