Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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

Discussion in 'cPanel Developers' started by Svintaj, Jul 22, 2016.

Tags:
  1. Svintaj

    Svintaj Member

    Joined:
    Jul 22, 2016
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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%3A%3Astore_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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,396
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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:

    [​IMG]

    Thank you.
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    Svintaj likes this.
  3. Svintaj

    Svintaj Member

    Joined:
    Jul 22, 2016
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,396
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I'm happy to see the information provided to you was helpful. Thank you for updating us with the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    Svintaj likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice