diff --git a/src/rules.c b/src/rules.c index 6cb40b5..d78472e 100644 --- a/src/rules.c +++ b/src/rules.c @@ -340,9 +340,12 @@ size_t nmatch=0; int ismatch = 0; - if(state->n_attachments == 0) return RULE_UNDEF; + // If no attachment rule, then return RULE_UNDEF + if(rule->emptyaname == 1 && rule->emptyatype == 1 && rule->attachment_size == 0) return RULE_UNDEF; - if(rule->emptyaname == 1 && rule->emptyatype == 1) return RULE_UNDEF; + // If we have attachments, but no attachment rules, then return RULE_NO_MATCH + if(state->n_attachments == 0 && (rule->emptyaname == 0 || rule->emptyatype == 0 || rule->attachment_size)) return RULE_NO_MATCH; + for(i=1; i<=state->n_attachments; i++){ ismatch = 0;