Moving Spam Messages to Spam Folder is done by MDA

Dauser Martin Johannes mdauser at
Mon May 21 01:36:23 CEST 2018

On Thu, 2018-05-10 at 19:49 +0200, Marc Stürmer wrote:
> Am 08.05.2018 um 23:53 schrieb Philip:
> > I'm having some problems moving messages marked as spam to the IMAP spam
> > folder.  I'm aware that amavis-new will run spamassassin and clamav then
> > pass it back to postfix for delivery but currently it's being
> > DISCARDED.  Messages that don't contain a virus I'd like to move into a
> > SPAM folder.
> > 
> > Is this done within AMAVIS or is this done once the mail is handed back
> > to postfix for delivery?
> Look for spam_lovers, virus_lovers and final_spam_destiny in the
> documentation.

Amavis can pass to recipient's email address, bounce, reject or discard
the email. Oh, and quarantine it of course.

Moving emails with spam tags to a special folder is the job of your
Mail Delivery Agent (MDA), which is most likely using the IMAP-Protocol 
(e.g. dovecot -- i.e. pigeonhole ). Depending on your MDA there are
different ways to achieve this.

I gave my users a simple sieve-script rule, which needs to be fed to
dovecot's pigeonhole by the user himself. But it should be possible to
set this as a general rule. 

require ["fileinto"];
# rule:[SpamIntoJunk]
# Move mails which Spamassassin tagged as spam into the "Junk" folder.
if header :contains "X-spam-flag" "YES" {
     fileinto "Junk";

Our Junk folder is on the same level as the INBOX, otherwise you need
to adjust the command fileinto.

  + folders_defined_by_user

More information about the amavis-users mailing list