Replace Attachment's based on total size
Markus Nilsson
markus at markusoft.se
Sun Jan 31 18:55:39 GMT 2010
Hi!
I would like to create a rule in MailScanner that quarantines all
attachments if the total size of all attachments are bigger than 5MB,
and replace all attachments with a single file. I guess this means I
have to write a CustomFunction for
Maximum Attachment Size =
that returns different sizes depending on the mail that is processed. In
pseudo-code something like:
sub Myfunc {
my($message) = @_;
my $sum = 0;
foreach my $attachment (message->{attachments})
{
$sum += $attachment->size;
}
if ($sum > 5000000)
{
return 1;
}
else
{
return 5000000;
}
}
To get the attachment quarantined I need to set
Quarantine Infections = yes
I don't know how to achieve the last thing, to get all the attachments
replaced by a single text-attachment. Can I write a customfunction for
Stored Size Message Report to acheive this and in that case how?
Stored Size Message Report = %report-dir%/stored.size.message.txt
Any recommendations on how to implement the above, are highly
appreciated! (both about the last thing about the text report, and about
how to implement Maximum Attachment Size)
Thank you
/Markus
More information about the MailScanner
mailing list