[Mimedefang] Question about what to do with discovered spam.
Rob
rob_macgregor at hotmail.com
Fri Feb 27 09:58:08 EST 2004
> -----Original Message-----
> From: mimedefang-bounces at lists.roaringpenguin.com
> [mailto:mimedefang-bounces at lists.roaringpenguin.com] On
> Behalf Of James Beal
>
> What I would prefer is to create a new mail message which has
> the same subject as the original, which has its body as the
> spam report and has the original email as an attachment. Any
> guidance would be appreciated.
I use the following, which does exactly that. Well, actually it creates 2
attachments. The first is the original email in text form - ideal for
reporting spam. The second is the original email as if it was forwarded -
ideal for reading it if mis-tagged.
Watch out for line wrapping!
# Record who it was for
action_add_header("X-Orig-Rcpts", join(", ", @Recipients));
# Remove original recipients
foreach $recip (@Recipients) {
delete_recipient($recip);
}
# Send to the postmaster
add_recipient('postmaster at the-macgregors.org');
# A container for the original message
my $raw_container = MIME::Entity->build(
Type => 'text/plain',
Description => 'Raw message',
Data => [ "" ],
);
my $container = MIME::Entity->build(
Type => 'message/rfc822',
Description => 'Original message',
Data => [ "" ],
);
my $parser = new MIME::Parser;
open(IN, '< INPUTMSG');
my $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
$raw_container->add_part($original);
$container->add_part($original);
my $reportPart = MIME::Entity->build(
Type => 'text/plain',
Description => 'spam warning',
Data => [
$report
],
);
$entity->parts([$reportPart]);
$entity->head()->mime_attr('content-type' => 'multipart/mixed');
$entity->head()->mime_attr('content-type.boundary'
=> '------------=_' . scalar(time) .
"-$$-nikc");
$entity->add_part($raw_container);
$entity->add_part($container);
action_change_header('Subject', "SPAM ($hits): $Subject");
action_rebuild();
It's based heavily on somebody else's work, sadly I don't remember who.
PLEASE - keep list traffic on the list. Email sent directly to me may be
ignored utterly.
--
Rob | What part of "no" was it you didn't understand?
More information about the MIMEDefang
mailing list