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 create a Global email filter on the command line?

Discussion in 'cPanel Developers' started by rogerw, Feb 2, 2017.

Tags:
  1. rogerw

    rogerw Member

    Joined:
    Feb 21, 2012
    Messages:
    22
    Likes Received:
    4
    Trophy Points:
    53
    cPanel Access Level:
    Website Owner
    I reviewed the thread here:
    Creating global email filter via command line

    and the documentation here:
    UAPI Functions - Email::store_filter - Software Development Kit - cPanel Documentation

    Can a developer, or anyone help me here?

    I'm at a loss how to create the filter I need. What I'm trying to do is:
    1. Create a global email filter
    2. A filter name of: No Reply
    3. A rule for any email "To" that contains "no-reply@domain.com"
    4. Fail with the message: Error - Sorry this mailbox is unmonitored.
    5. Then: Discard Message
    Can anybody help me create the correct syntax for the rule?

    I know is should begin with:

    Code:
    uapi --user=username Email store_filter filtername=No Reply=no-reply%40DOMAIN.com action1=fail
    but I get lost after the "fail" (for "action1=") part.

    Thanks!
     
    #1 rogerw, Feb 2, 2017
    Last edited: Feb 2, 2017
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You can utilize a command such as:

    Code:
    uapi --user=$username Email store_filter filtername=No%20Reply action1=fail dest1=Error%20-%20Sorry%20this%20mailbox%20is%20unmonitored. part1=\$header_to: match1=contains val1=no-reply%40domain.com
    You do not need to discard the message if you are already bouncing it with the "Fail" action.

    Let us know if this helps.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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