Postfix/Dovecot SpamAssassin/Amavisd-new deleting spam


I've setup my server with the above packages, along with Clamav and Clamav-daemon. (See my signiature for a complete list of packages I've installed.)

All the spam mail I'm receiving (about 10 mails/day) has the Subject prepended with 'SPAM'. In my Outlook client, this is not a problem as I have a rule that moves them to a seperate folder and I manage them there. However my iPhone doesn't do this, so my display is cluttered with past spam messages.

Today I configured my server to move spam mail into the Junk directory for the mail accounts I'm monitoring on the iPhone. I'm hoping this will fix the clutter problem on my iPhone.

By moving the spam to the Junk folder, I'm worried that eventually my mail server will be overloaded with junk mail.

I understand that I can setup webmail (IMAP) and manage the Junk mail that way, but with lots of email accounts to check, this is not really satisfactory.

Can I setup SpamAssassin to delete mail in the junk folder after X days?



3 Replies

That's not really SpamAssassin's job. You can set up a Dovecot plugin to do this. Alternatively, you could use your own script like this guy (via IMAP) or to directly delete the files in the Maildir (probably not as nice to Dovecot to do it that way).

thnx Vance. I've had a look and I like the way it works.

Spamassassin doesn't assassinate? lol. SNAG software.

I've been reading on the subject in the meantime, and have seen references to using .procmail scripts to do this.

Are Dovecot and Procmail compatable, or do they perform the same function within the mailing end-end process, and therefore not able to run side-by-side?

Procmail is a mail delivery agent (MDA). Postfix has its own called local, and Dovecot also has one called deliver. The job of an MDA/LDA is to process mail destined for a local user - once a message is delivered, it generally won't touch it again.

So all SpamAssassin really does is tag messages; the MDA/LDA then deletes them (often by "delivering" to /dev/null) or files them in a junk folder based on the headers added by SpamAssassin. It looks like Dovecot's deliver can handle this function, either natively or with the Sieve plugin.

In short, procmail can be useful if you need capabilities that local or deliver don't provide, but none of them are really intended for processing mail after it's been delivered to the local user.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct