How to set the "Fail with message"-text, UAPI Email store_filter

Svintaj

Member
Jul 22, 2016
7
0
1
Stockholm - Sweden
cPanel Access Level
Website Owner
Hello!

I am writing a cPanel session URL call to create a email filter, it works well but now I can't find how to set the "Fail with message"-text?

I have read this documentation, but I must have missed something:
https://documentation.cpanel.net/display/SDK/UAPI+Functions+-+Email::store_filter

Can anyone help me with how to set the "Fail with message"-text, when creating an a email filter trough a cPanel session URL call?

Thanks in advance.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

Here's an example of what the filter rule looks like in the /etc/vfilters/$domain file:

Code:
#TestRule
if
$header_from: contains "Test123"
then
if error_message then save "/dev/null" 660 else fail fail "Test Failure Message 123" endif
endif
Thus, to answer your question, for the action parameter of this UAPI function, enter it as:

Code:
fail "This is a test failure message"
I verified this works as expected using the API Shell option in cPanel:



Thank you.
 

Attachments

  • Like
Reactions: Svintaj

Svintaj

Member
Jul 22, 2016
7
0
1
Stockholm - Sweden
cPanel Access Level
Website Owner
Thank you Michael, now you made me understand!:)

I first thought I had to pass a variable so I was trying: fail&fail="This is a test failure message", with no luck. Was banging my head against that wall, thought I just needed the right variable-name and tried everything I could imagine...

But now I realize that I just have to write: fail "This is a test failure message", just as you said and it works perfect.

Many thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
I'm happy to see the information provided to you was helpful. Thank you for updating us with the outcome.
 
  • Like
Reactions: Svintaj