procmail
[Top] [All Lists]

Re: Can not get a filter recognised for one email source

2011-02-16 05:01:46

From: Anne Wilson <cannewilson(_at_)googlemail(_dot_)com>
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Subject: Can not get a filter recognised for one email source
Date: Wed, 16 Feb 2011 09:44:55 +0000


I get regular emails from one list, that always end up in my Inbox, no 
matter what I put in the recipes.  At the moment these two recipes 
are in place:

:0
* (^From|^To|^Subject): 
.*(Janome|embroidery|Embroidery|emblibrary|empressmills)
${MAILDIR}.INBOX.Sewing/

:0
* ^From: .*Debra\@emblibrary.com
${MAILDIR}.INBOX.Sewing/

Among the headers of the mail are the following lines:

Received: from mail.emblibrary.com ([69.54.45.82]) (envelope-from 
<Debra(_at_)emblibrary(_dot_)com>)
from: Debra(_at_)emblibrary(_dot_)com 
subject: Feather Your Nest - New at Embroidery Library!
X-Envelope-From: Debra(_at_)emblibrary(_dot_)com

none of these trigger a match, and I've no idea why.  Any ideas?

This is just a *GUESS*. 

  Background: 
    1) The mail you show is -not- standards compliant.  Message "header" 
       lines are required to start with an upper-case letter.

    2) 'Default' for a procmail recipe is to apply the checks against 
       the headers only.

    3) message format is:
         headers
         blank line
         body

_Apparently_, when procmail scans the message, and sees something that is 
"not a valid header" _before_ the blank line, it does *NOT* treat it it as
a header line. 

Two possibilities why: 
  1) it simply 'ignores' that invalid line, and continues on -- looking
     for the next 'valid' header, or the 'end of headers' blank line.
  2) it 'assumes' that the 'end of headers' blank line was missed, and that
     this is 'body' text.


The 'right' solution to this problem is to get the mailing list to fix their
BROKEN, NON-STANDARDS-COMPLIANT, software.

A possible work-around -- *if* 'possibility 2', above applies -- is to stick
"HB" flags on those two recipes.   Doing that would mean possible 'false
positives' on other mail, but given the nature of the specific patterns,
it's very unlikely to be a problem.


_IF_ 'possibility 1' applies, _and_ the list owner won't fix =their= problem,
one can repair things on the receiving end, but it takes some actual 
"programming".  Need a program that will convert 'from:' and 'subject:', 
when encountered at the beginning of a line, and before the first blank
line, to 'From:' and 'Subject:', respectively.  Then, you invoke this
program, as a 'filter', in a recipe with no conditions, _before_ the 
two recipes you show above.  A crude, ugly, brute-force solution, but it
will get the job done.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail