procmail
[Top] [All Lists]

Re: procmail Efficiency Question

1999-03-23 23:55:16
On Tue, 23 Mar 1999 13:35:54 -0500, "Banerjee, Tapas"
<Tapas(_dot_)Banerjee(_at_)gs(_dot_)com> wrote:
      Following is the recipe and my questions. Appreciate replies
on questions and any tips from procmail experts, which will improve
efficiency of mail distribution.
<...>
:0:
* ^Subject:*.monalisa
* !^Subject:*.RE:           # ignore any replies
* !^FROM_DAEMON             # ignore mail from mailer daemons
* !^From:*.ess              # not the self mail
* !$SENDER ?? $LIST_SENDERS # one of the valid senders

*. is not a valid regular expression; you mean .* (except most of the
time, you don't really -- see e.g. the RE: comment below).

For efficiency, you could reorder these conditions a little bit.
Anything with .* in it should probably be later than the more focused
regular expressions. 

Subject:.*RE: is not what you want, it will match on e.g. "Subject:
who we are: random losers!". Furthermore, a better way to spot replies
(although not 100% sure to work, there are broken mail programs which
don't conform to even the most basic RFC822 etc requirements) is to
look for In-Reply-To and/or References headers.

If you want to look for Subjects which have "re" as a free-standing
token in the first clump of alphabetic characters, try something like
Subject:\<*re\>

The same logic probably applies more or less to all occurrences of .*
-- you usually want the matches to be more constrained than that.

| (formail -A"Bcc: internal_list" \
           -I"To: ess_mailing_list" \
           -I"From: ess(_at_)nyamdweb246(_dot_)gsam(_dot_)gs(_dot_)com" \
           -i"Subject: monalisa REPORTS " ) >> monalisa_mails.`date 
'+%H%M%S'`

You could avoid calling date(1) by using the date in the From_ stamp.
This is something that has been discussed on the list numerous times;
try <http://www.rosat.mpe-garching.mpg.de/mailing-lists/procmail/> or
ask again if you can't find any good pointers in the archives.
 
Q 1: Will it be a better idea to trap the Arguments as SUBJECT =
`formail -zx Subject` dynamically and pass that in heading field
i.e. in place of -i"Subject: DAVINCI REPORTS " use -i"Subject:
$SUBJECT_reports " ?
       Initially I thought of these, but there will'be several
mails - locking a single file did not looked to me a good idea.

I'm not sure I understand really, but this does not sound like it
would buy you anything. If you want to grab the Subject verbatim, it's
cheaper to do a simple grab:

    :0
    * ^Subject:[        ]*\/[^  ].*
    { SUBJECT=$MATCH }

(This is one of the few places where you really do want .* -- match
anything for as long as possible, i.e. to the end of the subject field.)

Q2. I also wanted to move first line of body to subject field in
Japanese(Kanchi) text.
      I could do using English text. But for Japanese character - outlook in
box mail
     coming as -
     Subject:
=?iso-2022-jp?B?GyRCJTQhPCVrJUklXiVzISYlNSVDJS8lOUVqPy4bKEogGyhK?=
             =?iso-2022-jp?B?GyRCNHA9YDJBM1sbKEo=?=  
     which when I forwarded, showed some junk character.     

Could you show an example of what happened? Forward the message back
from Outlook to something that can show the raw message.

Or do you mean the Subject: was intact as far as you could tell but
Outlook still failed to show it correctly (perhaps because of lack of
other MIME headers, although I don't suppose that should mean
anything)? (What happens if you pass on -XMime- -XContent- as part of
the formail snippet, would that help?)

Or do you mean you would like Procmail to produce the correct
=?iso-2022-jp?B?blahblahblah?= stuff in the Subject from something
encoded in some different way which you grabbed out of the body of the
message?

/* era */

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

<Prev in Thread] Current Thread [Next in Thread>