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

Robert Bonomi <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
> From: Anne Wilson <[email protected]>
> To: [email protected]
> 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 <[email protected]>)
> from: [email protected] 
> subject: Feather Your Nest - New at Embroidery Library!
> X-Envelope-From: [email protected]
>
> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.