procmail
[Top] [All Lists]

Re: Adding custom mail headers via a filter?

2002-10-25 08:48:00
On 25 Oct, Robert Nicholson wrote:
| I'm noticing that with the following two rules.
| 
| :0 fw:$HOME/strip.lock
| * ^Content-type:.*boundary
|| $HOME/perlscripts/strip_attachments.pl
| 
| #let filtmail do the rest
| :0 HB
| * ? $HOME/.filtmail/filtmail
| $MAILDIR/copy
| 
| Note filtmail is not a filter this time so the only variable at play is 
| exit status.
| 
| Anyway, I'm currently seeing that any mail going through 
| strip_attachments.pl
| get it's _whole_ From_ removed thus totally confusing my MUA.
| 
| Is it a known procmail problem with the _entire_ From_ goes missing 
| rather than
| just the easily correctable first character?
| 
| This is the strip_attachments filter again
| 
| #! /usr/bin/perl5 -w
| 
| use lib "$ENV{HOME}/lib/perl5/site_perl";
| 
| use IO::Scalar;
| use MIME::Parser;
| use MIME::Entity;
| 
| my $parser = MIME::Parser->new;
| 
| $parser->output_to_core(1);
| $parser->tmp_to_core(1);
| 
| #$envelope = <STDIN>;
| 
| my $ent = $parser->parse(\*STDIN);
| 
| [...]
|
| #print $envelope;
| $ent->print;

A shot in the dark.  I don't have MIME::Parser or MIME::Entity
installed to look at them, nor have I ever used them.  But I did play
around with your stuff a little the last time you posted about this to
see how the headers were parsed.  From distant recollection only,
something in one of the scripts used a regular expression matching the
colons in header lines, and treated the envelope From_ specially. 
Again, IIRC, a hash was populated with key=>value pairs of Header: and
Content, with the envelope From_ getting a distinctly odd key. I don't
see that here, but I'd be suspicious that something in one of the
scripts is not reassembling the envelope From_ correctly.

More specifically to this post, the lines commented above:

| #$envelope = <STDIN>;

and

| #print $envelope;

looks like the envelope From_ is not even being processed separately,
but with the rest of the headers.  Are you sure you don't need these 2
lines?  If you think not, and my recollection is correct about how the
headers are processed, are you sure the script is handling and
reassembling From_ correctly?

None of this would explain the apparently different behavior you see
between using this as a filter and not, but after all it is just a shot
in the dark. Those commented lines in the context of the "new" behavior
of no From_ at all, look suspicious to me.

-- 
Reply to list please, or append "8" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail