[Mimedefang] Question about modifying headers in filter_end

jbird at micron.com jbird at micron.com
Tue Jul 15 19:39:00 EDT 2003


I am running MimeDefand 2.33 on a Solaris 8 box and perl v5.6.1.


I have been directed to implement functionality where by a certain list
of people are not allowed to receive internet email.  In fact it should
look as is if the message was never sent to them at all.


I am working in filter_end.  So far I have...

foreach $addr ( @Recipients )
{
    if ( $addr eq '<bogus at micron.com>' )
    {
        delete_recipient('<bogus at micron.com>');
        action_notify_sender("bogus\@micron.com was not allow to receive
this message.\n");
    }
}

This will indeed not deliver the message to bogus at micron.com.  But it
does leave that address in the To: (or Cc:) header line.  So next I
tried this...

my($entity) = @_;
my $mHead = $entity->head();
my $mTo = $mHead->get('to');

to get the To: line. (please note that the rest of this code isn't
complete yet but that will be finished later when this issue is
resolved)  If bogus at micron.com is in $mTo, I would remove it, then use
action_change_header('To', $mTo); to complete the change and viola.
However, $mTo is undefined.  If I try looking at another header line,
mime-version: for example, all is well.

my $mMV = $mHead->get('mime-version');

In my testing, the HEADERS file does contain the To: (Cc: if
appropriate) and other header lines.

In other related testing, I wrote this program with some help from the
MIME::Tools documentation to test the same MIME::Header object get
methods...


use MIME::Parser;

### Create parser, and set some parsing options:
my $parser = new MIME::Parser;
$parser->output_under("/temp");

### Parse input:
$entity = $parser->parse(\*STDIN) or die "parse failed\n";

### Take a look at the top-level entity (and any parts it has):
$entity->dump_skeleton;

my $Head = $entity->head();

print "To: ",       $Head->get('to'), "\n";
print "Cc: ",       $Head->get('cc'), "\n\n";
print "Subject: ",  $Head->get('subject'), "\n\n";


And invoke it like this: perl mimeparse.pl < message.eml  redirecting a
saved message.  All works well.


Is it the case that the MIME entity object passed into filter_end is
incomplete or am I missing something else?

Lastly, (thanks for bearing with me and my long post) the
action_notify_sender("bogus\@micron.com was not allow to receive this
message.\n"); call never generates a response to the sender to let them
know that bogus was not allowed to receive the message.  Is there
something else that must be called to complete the notification process?

Thanks for your response,
	John Bird





More information about the MIMEDefang mailing list