Results 1 to 2 of 2

Thread: How to do NOT in email filter?

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    132

    Default How to do NOT in email filter?

    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!
    Last edited by Wallaby; 12-17-2006 at 07:00 AM.

  2. #2
    Member
    Join Date
    Feb 2003
    Posts
    191

    Default

    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

Similar Threads

  1. Need guide to create email filter (email spoofing)
    By wefrank in forum E-mail Discussions
    Replies: 0
    Last Post: 05-17-2008, 10:15 AM
  2. Email Filter
    By romans815 in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 02-15-2008, 01:17 AM
  3. Email filter results in all email being sent to /dev/null/
    By safemill in forum E-mail Discussions
    Replies: 1
    Last Post: 07-13-2007, 10:02 AM
  4. Cpanel: email filter option--email to script
    By bobw in forum E-mail Discussions
    Replies: 1
    Last Post: 01-22-2005, 04:52 PM