The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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::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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    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:

    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:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page