Detecting a blank header in the content filter

The content filter has a condition to trip if a header doesn’t exist.  However, there is no easy way to catch a header with no content at all.

This rule will trip on a blank subject header (where the header DOES exist, but has no content)

[Rule001]
RuleName=If subject is NOT empty, Skip next rule
Enable=Yes
ThisRuleCondition=All
ProcessQueue=LOCAL
Condition01=SUBJECT|reg exp|AND|^..+$|
Action01=skip rule|"1"
[Rule002]
RuleName=Subject IS empty!
Enable=Yes
ThisRuleCondition=All
ProcessQueue=LOCAL
Condition01=SUBJECT|exists|AND|
Action01=move to bad Msg|

UPDATE 2009/06/17: For some reason this rule was completely broken, both by WordPress inserting smartquotes, and a logic error. My apologies, it has been corrected and tested on MDaemon 10.0.5, it should now work as advertised.

CC BY-NC-ND 4.0 Detecting a blank header in the content filter by Dave Warren (everything-mdaemon.com) is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

2 Replies to “Detecting a blank header in the content filter”

  1. Got this from [md-cfilter] reject “no subject”
    This works for messages with blank subjects

    emails – outbound
    RuleName=Blank
    Enable=Yes
    ThisRuleCondition=All
    ProcessQueue=BOTH
    Condition01=SUBJECT|reg exp|OR|^ *$|
    Action01=move to bad Msg|

  2. Noy,

    This is true, if the subject header contains a space like this: “Subject: “, however if the subject has no trailing space (like “Subject:”) then the “^ *$” format fails to trip.

Leave a Reply

Your email address will not be published. Required fields are marked *

*