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 do NOT in email filter?

Discussion in 'E-mail Discussions' started by Wallaby, Dec 17, 2006.

  1. Wallaby

    Wallaby Well-Known Member

    Joined:
    Aug 15, 2001
    Messages:
    131
    Likes Received:
    1
    Trophy Points:
    18
    I want to be able to say:

    If the headers do NOT contain Special-String then Discard

    in an email filter. Regex is I'm sure the way to go:

    Filter ... Any Header .. that ... matches regex ... ???? Destination ... Discard

    but I'm not familiar with designing regex expressions. Can anyone help?

    EDIT: Actually, thinking this through, what I want to say is "if NONE of the headers contain Special-String..."

    The application is this: mail is passed through an antispam device before it arrives at the CPanel server. The device adds a certain header to mail that it processes. However, some spammers ignore the MX record and mail direct to the main domain IP, hence bypassing the antispam device. I want to ensure that only mail that:

    a) Was sent from the antispam device, or

    b) Originates on the same server the domain is hosted on

    gets accepted.

    Ideas welcome!
     
    #1 Wallaby, Dec 17, 2006
    Last edited: Dec 17, 2006
  2. HostIt

    HostIt Well-Known Member

    Joined:
    Feb 22, 2003
    Messages:
    151
    Likes Received:
    1
    Trophy Points:
    18
    AFAIK you'd want to edit the /etc/vfilters/domain.com file to something along the lines of the following. Beware that cPanel may overwrite the custom command if the filters are subsequently edited via the cPanel interface, as it doesn't deal with "does not contain" at this point in time. I'm not sure there's any danger of the file being overwritten under other circumstances, for example a nightly update etc, but I'm about to try this myself.

    Code:
    if
     $message_headers does not contain "Special-String"
    then
     save "/dev/null" 660
    endif
    
     
Loading...

Share This Page