[Mimedefang] resend_message question

James Ebright jebright at esisnet.com
Thu Jul 7 09:40:06 EDT 2005


On Wed, 6 Jul 2005 16:52:42 -0500, Charles Mount wrote
> What I want to do is to capture these messages to get more 
> information on their source.  Mi idea is to use this command.   I 
> need to know where to put it within mimedefang-filter.
> 
> if ($ip =~ /^123.234/) {resend_message('firewall.bounce at comp.any');}
> 
> I assume I will also need a line like
> my($sender, $ip, $name, $helo) = @_;
> which I also need to know where to put.

I would probably try this in filter_end before spamassasin rules (if any) as
all of the information you need should be available there. You also might
consider using KAMs report safe code to implement a report similar to this,
note, this expects the "report" to be available in the variable $report
(although simple enough to change this) and the default filter uses $report
inside filter_end and fills it inside spam_assassin_check(); call, just be
aware of this to avoid unexpected "reports":

                # BEGIN REPORTSAFE - KAM 10-29-2003
                # Implement Report_Safe -- Thanks to James W. Curtis for the
original starting code!
                my ($container, $parser, $original, $report2);

                $container = MIME::Entity->build(Type => 'message/rfc822',
Description => 'Original message before MIMEDefang', Data => [ "" ]);
                $parser = new MIME::Parser;
                open(IN, '< INPUTMSG');
                $original = $parser->parse(\*IN);
                close(IN);

                $original->head()->replace('X-Relay-Addr', $RelayAddr);
                $RelayHostname ||= 'N/A';
                $original->head()->replace('X-Relay-Host', $RelayHostname);
                $original->head()->replace('X-Relay-Time', scalar(localtime));

                # Add the original message to the container
                $container->add_part($original);

                #JRE Outlook would display only a blank page, because the SA
                #report was tagged as having a FileName
                $report2 = MIME::Entity->build(Type => 'text/plain',
Description => 'SpamAssassin Warning', Data  => ["$report\n"], Disposition =>
"inline", Encoding => "-suggest");


                $entity->parts([$report2]);
                $entity->head()->mime_attr('content-type' => 'multipart/mixed');
                $entity->head()->mime_attr('content-type.boundary' =>
'------------=_' . scalar(time) .  "-$$-nikc");
                $entity->add_part($container);
                action_rebuild();
                # END REPORTSAFE

Jim
--
EsisNet.com Webmail Client




More information about the MIMEDefang mailing list