[Mimedefang] Passing Variables from SA to DF

Kelson kelson at speed.net
Wed Jun 14 12:21:01 EDT 2006


Gary McLean wrote:
> My other issue is, im trying to add extra headers to scanned emails that
> Spam Assassin checks for. i.e. Ive tried adding the IS SPAM value and
> X-Relay-Countries but the header appears but the value is blank.. How do I
> get he value from the Spam_assassin_Check routing into DEFANG so that I can
> set the header?
...
> my($hits, $req, $names, $report, $countries, $isspam) =
> spam_assassin_check();

I had a similar problem where I wanted to retrieve the Bayes autolearn 
status from SpamAssassin.

What you're trying won't work because spam_assassin_check only returns 
four variables.  When you ask for six, the last two end up being 
undefined.  (Perl is forgiving and makes them blank instead of blowing 
up in your face like other languages would.)

What I ended up doing was copying the spam_assassin_check function from 
mimedefang.pl and modifying it to return the values I needed.  In my 
case it retrieves $status->get_autolearn_status() and makes that the 
fifth item in the return value.  Then I replaced all instances of 
spam_asssassin_check in my filter with spam_assassin_check_customized.

You'll probably need to look at either the SA docs or the SA code to 
figure out what you can pull out of the object to get the country info. 
  IS SPAM is probably in there too, but you could also calculate it by 
checking whether $hits >= $req.

-- 
Kelson Vibber
SpeedGate Communications <www.speed.net>



More information about the MIMEDefang mailing list