procmail
[Top] [All Lists]

Re: Thanks and Has anyone seen this...

1997-04-29 00:59:00
On Mon, 28 Apr 1997 18:25:09 -0500, Dennis Davison
<ddavison(_at_)execpc(_dot_)com> wrote:
Now onto something fun. Below is the header from one of my small list
subscribers. Look closly and you'll see after Content Type and before
hopfen(_at_)malz(_dot_)com there is a blank line. This blank line seperates 
the To:
and Subject: info. As a result Procmail will not see the To: or Subject
and will not forward it. It believes  that the blank line is now going
to start the mail. 
My question, is there any way around it on my end? I know I could use
the From: and be able to forward this guys stuff, but if he gets on a
couple of my lists, this won't work correctly.....

The ultimate fix, for a vast number of reasons, is to persuade this
person to not use broken software. Perhaps unsubscribe him as a small
friendly nudge in the right direction? ;^)

Failing that; yes, Procmail is very good at doing various things to
incoming mail that meets certain conditions.

You could stick the following somewhere near the beginning of your
list processing recipes to "normalize" the broken header:

    # Remove the first blank line and change the following 
    #  spurious hopfen(_at_)malz(_dot_)com to something marginally sensible

    :0f
    * ^From:(.*\<)?hopfen(_at_)malz\(_dot_)com
    | awk '(done == 1)         { print;                       next } \
           /^$/                {                              next } \
           /^hopfen(_at_)malz\(_dot_)com/ { print "Sender: " $0; done=1; next } 
\
                               { print } '

This will run the entire message through awk; if messages are
typically long, it might be better to deal only with the header of the
message (but then you'll need two separate recipes if you want to fix
the lone hopfen(_at_)malz(_dot_)com line. It's probably harmless, though).
  This will still leave you with two From: lines; dealing with that
(or not dealing with it) is left as an exercise.

You might have to remove any line breaks and whitespace from the awk
script and stuff it all on a single line if your version of awk is
prehistoric (i.e. "classic" awk). [Or you can save the script in a
file and use awk -f.] [And apologies for the clumsy awk script, I'm a
Perl programmer.]

<...>
From: hopfen(_at_)malz(_dot_)com
Received: from [199.6.41.250] by crystal.iac.net with ESMTP
        id NAA19836; Mon, 28 Apr 1997 13:56:07 GMT
Date: Mon, 28 Apr 1997 13:56:07 GMT
X-Sender: hopfen(_at_)iac(_dot_)net
Message-Id: <v03102800af8a5b456fcd(_at_)[199(_dot_)6(_dot_)41(_dot_)250]>
In-Reply-To: 
<199704281316(_dot_)JAA02708(_at_)dave(_dot_)nrl(_dot_)navy(_dot_)mil>
References: <199704272156(_dot_)QAA23241(_at_)xnet(_dot_)com> from 
"korz(_at_)xnet(_dot_)com" at Apr
 27, 97 04:56:39 pm
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"

hopfen(_at_)malz(_dot_)com
Date: Mon, 28 Apr 1997 09:49:40 -0400
To: beerscore(_at_)bjcp(_dot_)org
From: Ed Westemeier <hopfen(_at_)malz(_dot_)com>
Subject: Re: issues list

Anything you can do in a shell / sed / awk / Perl script you can do
from within Procmail. To use Procmail to its full potential, it would
make sense to learn a small bit of shell programming. With all due
respect, the bookstores carry tons of "Unix for practically braindead
losers" type titles. You can probably get last year's edition dirt
cheap. (If that's not your style, try the O'Reilly or Addison-Wesley
titles.)

Hope this helps,

/* era */

Please, people, there's only two e's in "separate". Or as somebody put
it, "there's a rat in 'separate'". 
  (Watch America learn to spell "rat" with an e.)

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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