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.

regex & mail filter

Discussion in 'E-mail Discussions' started by traviscox, Jan 28, 2004.

  1. traviscox

    traviscox Member

    Joined:
    Oct 3, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    All,

    I have been fiddling about with the filtering capabilities, trying to eliminate some spam that has become quite regular of late. Since I was having no luck filtering on the actual spam, I tried to just do some more simple filters to see whether I was doing something wrong with the regex definitions or whether it was another problem.

    I created a filter to locate the word "Mary" in any email and send those emails to a different email address. Obviously this is a stupid rule to use in reality, but it's simple for testing. The settings are:

    ==============
    FILTER: Body
    that
    MATCHES REGEX
    /Mary/
    DESTINATION: mary@mydomain.com

    ==============

    I then sent an email from a Lycos account containing the text "Mary had a little lamb" which should have - to the best of my understanding - been detected as containing the word "Mary" in the body and sent to mary@mydomain.com instead of my regular email address.

    This did not happen - it just came through to my regular address and was not filtered in any way.

    Anyone got any ideas?

    Thanks in advance,

    Trav.

    PS: If you're wondering why I chose "mary" as a test method, I went through the cpanel docs first, and read http://gnosis.cx/publish/programming/regular_expressions.html as directed, but what works on that page does not work for me.
     
  2. charlie

    charlie Member

    Joined:
    Aug 19, 2001
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    I have done some fiddling with the Matches_Regex option in the filters. It seems from my tests that the beginning and ending slashes are added by the script automatically or are just not needed.

    /Mary/
    would not work for me but

    Mary
    does

    What I really would like to see is the ability do multiple header line filtering like

    If the email is TO: Joe@joesdomain.com
    AND
    the spam header line contains YES
    Discard
     
  3. traviscox

    traviscox Member

    Joined:
    Oct 3, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    charlie,

    Oops. I neglected to respond to this forum to note that I had also discovered the slashes to be redundant. I posted this query on another forum and when I discovered the problem, I responded to my own posting there but overlooked this one. My apologies. Since there had been no other responses to this thread, it slipped my mind.

    Thanks for your response though - if I had not worked it out by now, I would still be going mad and you'd be the saviour of the day. Ideally when someone else reads this thread, you will be their saviour of the day!
     
Loading...

Share This Page