<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
I have a need to selectively NOT archive clean emails under certain
circumstances.<br>
we archive clean email on some servers, NOT because we want the
emails, but because we want to feed VIRGIN emails back to SA for
learning.<br>
(exchange mashes the emails and headers.. imap wasn't so bad, but
ews really mucks them up)<br>
HOWEVER, I do NOT want to archive CLEAN emails > 400K.<br>
(I still want to archive large viruses, attachments, and spam)<br>
<br>
I have (almost) got this down, but just need last step. sql queries
work, I can calculate size, read values, just want to DISABLE
archiving for LARGE clean emails (note: maybe I am doing it in the
wrong place, maybe I need a per-user loop.. since one users clean is
another users spam.. but then again, maybe the flags are set on
is_in_contents_category just fine)<br>
<br>
<br>
using amavisd-custom.conf<br>
<br>
use strict;<br>
use DBI qw(:sql_types);<br>
use DBD::mysql;<br>
my $__archive_quarantine_in;<br>
BEGIN {<br>
import Amavis::Conf qw(:platform :confvars c cr ca $myhostname
$clean_quarantine_method @lookup_sql_dsn<br>
$sa_mail_body_size_limit);<br>
import Amavis::Util qw(do_log untaint safe_encode safe_decode);<br>
}<br>
<br>
sub new {<br>
my($class,$conn,$msginfo) = @_;<br>
my($self) = bless {}, $class;<br>
my($conn_h) =
Amavis::Out::SQL::Connection->new(@lookup_sql_dsn);<br>
$self->{'conn_h'} = $conn_h;<br>
$self; # returning an object activates further callbacks,<br>
}<br>
<br>
sub before_send {<br>
my($self,$conn,$msginfo) = @_;<br>
my($ll) = 3; # log level (0 is the most important level, 1,
2,... 5 less so)<br>
my($too_large) = $msginfo->msg_size >
$sa_mail_body_size_limit;<br>
my($already_quarantined) = $msginfo->is_in_contents_category(<br>
{CC_SPAMMY,1, CC_SPAM,1, CC_BANNED,1, CC_VIRUS,1}
);<br>
<br>
if ($too_large) {<br>
if(! $already_quarantined && $clean_quarantine_method
=~ /sql:/) {<br>
do_log(0, "CUSTOM: UNWANTED = $msg_size"."k >
".($sa_mail_body_size_limit/1024)."k");<br>
# I want to NOT archive if it hits here.<br>
}<br>
}<br>
<br>
<div class="moz-signature">-- <br>
Michael Scheidell, CTO<br>
o: 561-999-5000<br>
d: 561-948-2259<br>
<font color="#999999">></font><font color="#cc0000"> <b>| </b></font>SECNAP
Network Security Corporation
<style type="text/css">
<!--
.unnamed1 {
margin: 1em;
padding: 1px;
} -->
</style>
<ul class="unnamed1">
<li>Best Mobile Solutions Product of 2011</li>
<li>Best Intrusion Prevention Product</li>
<li>Hot Company Finalist 2011</li>
<li>Best Email Security Product</li>
<li>Certified SNORT Integrator</li>
</ul>
</div>
<br>
<div id="disclaimer.secnap.com"><hr />
<p>This email has been scanned and certified safe by SpammerTrap®.
<br />For Information please see
<a href="http://www.secnap.com/products/spammertrap/">http://www.secnap.com/products/spammertrap/</a></p> <hr /></div>
<br>
</body>
</html>