Delivery of Spam to alternate location?
Julian Field
mailscanner at ecs.soton.ac.uk
Sat Mar 15 15:25:56 GMT 2003
At 00:41 15/03/2003, you wrote:
>I see that Action, but unless I'm mistaken, mail would be forwarded to
>a specified email address. Rather than that, I'm looking for a way of
>sending the Spam to an alternative mail server, keeping the destination
>address intact or modifying it in a specific way.
>
>For example, if MailScanner identified as Spam a message sent to
>nicholas_esborn at affymetrix.com, it could rewrite the address as
>nicholas_esborn at spambin.affymetrix.com and send it along.
Okay, this is exactly the sort thing that a "Custom Function" could do.
Bung this in CustomConfig.pm:
my $spamserver = 'spambin';
sub SpamActions {
my($message) = @_;
return "deliver" unless $message; # Default if no message passed in
my($to, $user, $domain, result);
# Loop through each recipient of the message, building the Spam Actions
foreach $to (@{$message->{to}}) {
# Get the user at domain bits out
($user, $domain) = split(/@/, $to, 2);
$result .= "forward $user\@$spamserver.$domain ";
}
return "deliver" unless $result; # If something was wrong, no recipients?
return $result;
}
That all goes in CustomConfig.pm. You should also create empty functions
called InitSpamActions and EndSpamActions to be neat and tidy.
Then in your MailScanner.conf, set
Spam Actions = &SpamActions
High Scoring Spam Actions = &SpamActions
and restart MailScanner.
Obviously you should change the value of "spamserver" at the top of the
code to whatever your spam mail servers are going to be called.
I haven't tested it at all, but it should basically work okay.
--
Julian Field
www.MailScanner.info
Professional Support Services at www.MailScanner.biz
MailScanner thanks transtec Computers for their support
More information about the MailScanner
mailing list