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!

A single line Regex as the only filter fails with v.long e-mail headers

Discussion in 'E-mail Discussion' started by OldB, Nov 17, 2015.

  1. OldB

    OldB Member

    Joined:
    Jan 5, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    It has taken me 3 months! to isolate the problem but this is the Regex that causes the problem:
    Code:
    (\n(to|cc):(.*\n[ \t]){0,5}.*|^Received: from (.|\n)+[ \t]+for)[ \t]*<?(user1|user2)\@domain1
    when matched against All headers.

    When very long e-mail headers are tested the above Regex fails in the cPanel "Account level Filtering" test facility. V.long headers started to arrive in June/July 2015 - examples typically have a server names ending in: .mail.protection.outlook.com, .portsmouth.uk.ibm.com, eurprd07.prod.outlook.com, mcws-ironport3.johnlewis.co.uk, .outbound.protection.outlook.com.
    Obviously I can PM examples of specific headers that fail.
    Note that the above Regex *does* work fine for detecting recipients in 98% of e-mails.
    Is it my Regex code or ??? I would welcome any suggestions or feedback.
    My original post was here: e-mails cause a problem in non-trivial(inc.RegEx) cPanel/Exim.
    I got my version of cPanel from the link: cPanel User Documentation - Documentation - cPanel Documentation.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,479
    Likes Received:
    421
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Is there a reason why you started a new thread on the same topic as that other thread? Preferably that thread you started should be continued there.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. OldB

    OldB Member

    Joined:
    Jan 5, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    I started a new thread because my original title/description and content was a very fuzzy scenario as there were dozens of filters and dozens of Regexs in many of them - whereas...
    I have isolated the problem to be a single Regex in a single filter for the whole (new) account so is now tightly defined (+hopefully reproducable) and *may* actually be my error although the Regex does work 98% of the time - so hopefully isn't.

    The Regex seems to be OK at debuggex.com but I was hoping that someone might be a Regex wizard or have even written a better Regex that matches both the visible recipients as well as the "envelope" data as I am attempting to do in a single line so I don't have to (a) maintain a duplicate version of (user1|user2)\@domain as some of those can be too wide to see/compare and (b) use cPanel's and+or.

    If a moderator would like to combine the two posts then that would be OK by me but ideally the title would describe what it has taken me 3 months to isolate - i.e. the title of *this* new thread.
    BTW the cPanel I am using is: build=11.52.0.23 - my earlier link turned into a page title.
     
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