Release quarantined banned mail from zimbra one-liner!

There are a few methods floating about for getting hold of banned or otherwise quarantined email from zimbra, but none of them that I could find offered a way to just release the file into someone's mailbox (a lot for uudecoding the files attachments and getting them to the user by some other means). If you find yourself having to do this regularly, you this may help. *

Edit amavisd.conf.in

Add or edit the following line, adding auth_required_release=>0 to theAM.PDP-SOCK policy bank

$policy_bank{'AM.PDP-SOCK'} = { protocol=>'AM.PDP',log_level=>5,auth_required_release=>0, };

Reload amavisd

zmamavisdctl reload

Fetch and hack at amavisd-release

Get hold of amavisd-release ( http://www.ijs.si/software/amavisd/#download ), I just installed it with apt on my desktop and copied the amavisd-release file over to the zimbra box. Not sure why its not included in zimbra's amavisd-new stuff. It needs 2 changes:

Around line 161:

$fn_suffix eq '.gz' ? 'Z'
: $fn_path eq '' && $mail_id eq $mail_file ? 'Q' : 'F';
$quar_type = 'F'; # Add this to get around SQL errors, nasty workaround for now.
my($request_type) = $0 =~ /\breport\z/i  ? 'report'
Around line  81:

 $socketname = '/opt/zimbra/data/amavisd/amavisd.sock'; # modified for zimbra

Profit

sudo -u zimbra perl -T /path/to/amavisd-release banned-{full idof mail} {new recipient}

Modify the one liner to taste, and you now have an easy way of releasing mail in the future.

* OK it takes some setup, but its a one liner after that :)