amavisd-release does not work with SQL quarantine (missing quar_type = "Q")

Dino Edwards dino.edwards at
Mon Feb 20 14:16:18 CET 2017

Here's how to do it. In your amavis config file  set the following to get everything quarantined. :

$virus_quarantine_method = 'sql:';
$spam_quarantine_method = 'sql:';
$banned_files_quarantine_method = 'sql:';
$bad_header_quarantine_method = 'sql:';
$clean_quarantine_method = 'sql:';

Just out of curiosity, any particular reason you are using sql instead of local to quarantine? I used to use sql and the database became unmanageable because of the sheer amount of email that was stored in it. So, I don't recommend storing your email in the database. If you want to go local storage, set it like below. Ensure you set your $QUARANtINEDIR  path below to a mount point with plenty of space and ensure that it's owned by amavis:

$QUARANTINEDIR = "/some/mountpoint/with/plenty/of/space";
$virus_quarantine_method = 'local:virus/%m';
$spam_quarantine_method = 'local:spam/%m';
$banned_files_quarantine_method = 'local:banned/%m';
$bad_header_quarantine_method = 'local:bad_header/%m';
$clean_quarantine_method = 'local:clean/%m';

Dino Edwards

Hermes Secure Email Gateway
Hermes Secure Email Gateway combines Open Source technologies such as Postfix, Apache SpamAssassin, ClamAV, Amavisd-new, MySQL and CipherMail under one unified web based Web GUI for easy administration and management of your incoming and ougoing email for your organization. Anti-spam, anti-virus and anti-malware protection, encrypted S/MIME, encrypted PDF and SMTP TLS support, built-in email archiving, end-user self-service web gui.

Learn More & Download the free open-source appliance at:

-----Original Message-----
From: amavis-users [ at] On Behalf Of postmaster at
Sent: Monday, February 20, 2017 7:44 AM
To: Amavis Users <amavis-users at>
Subject: Re: amavisd-release does not work with SQL quarantine (missing quar_type = "Q")

Am 2017-02-16 14:03, schrieb postmaster at
> Dominic Raferd <dominic at> wrote
>> We use file-based quarantine. I tried this change and then 
>> amavisd-release does not work, I am sorry to report; there is no 
>> error message - just the mail is not released and the file remains in 
>> quarantine.
> Thanks for your answer.
> Could you try and write the whole filename including full path when 
> using amavisd-release.
> I think you should get the mail resent by amavisd-release like this.
> If $fn_path is emtpy $quar_type = 'Q' is used with my change.
> I don't know another way to get mails resent from SQL.

I found the underlying reason of this issue. We use the sql-based quarantine only for banned-files and virus, but not for spam. Therefore

$spam_quarantine_method = undefined;

In amavisd-new $quar_type defaults to 'F' if $spam_quarantine_method does not contain "sql:" see:

>      # choose some reasonable default (simpleminded)
>      $quar_type = c('spam_quarantine_method') =~ /^sql:/i ? 'Q' : 'F';

What do you recommend to solve this issue?

Thomas Sattler

More information about the amavis-users mailing list