[Top] [All Lists]

Re: Passing mail delivery onto /usr/bin/deliverquota with arguments defined by procmail

2009-02-25 07:08:54
I've finally managed to figure this out along with some other tricks to beef
up qmail/procmail spam handling on PLESK. In a nutshell, it places spam into
a spam folder, purges spam x days old, and will work universally across all
accounts on the system (e.g. no manual setup per account). Hope this helps
someone out... I've tried and tested this on 3 different production servers
and counting:

Here's a link to the tutorial:


On Thu, Jan 15, 2009 at 12:37 PM, Marcus Sykes 

Hi Charles,

Thanks for the reply. Sorry for the delay, I didn't get your message
until the digest sent it!

Anyway, yes, the $1 and $2 work fine. It all works fine until the
mailbox I'm testing runs out of space in it's quota. Then it is
completely discarded. No bounce message... nothing... and the message
is archived correctly too, and bounces fine when using the original
.quota file I mentioned.

Here is my log file;
procmail: Assigning "MAILDIR=/var/qmail/mailnames/"
procmail: Assigning
procmail: No match on "^X-Spam-Status: Yes.*"
procmail: Executing
procmail: Assigning "LASTFOLDER=/usr/bin/deliverquota
From test(_at_)domain(_dot_)com Thu Jan 15 11:33:21 2009
 Subject: Quota Test
 Folder: /usr/bin/deliverquota /var/qmail/mailnames/

This is the rc file I used to generate this:
LOGFILE = /var/qmail/mailnames/$1/$2/procmail.log
MAILDIR = /var/qmail/mailnames/$1/$2/Maildir

#Spam handler
* ^X-Spam-Status: Yes.*
| /usr/bin/deliverquota $SPAMDIR

#All other mail
:0 E
| /usr/bin/deliverquota $MAILDIR

On Wed, 14 Jan 2009, Marcus Sykes wrote:
And my rc file is currently:

Try echoing "$1" and "$2" to your logfile, to see if they really
are what you think they are.... Or hardcode the MAILDIR to test....
Or use $USER......

and if none of that works, post your logfile here....


On Wed, Jan 14, 2009 at 2:57 PM, Marcus Sykes 


New to procmail, and although I grasp the basics (which are a joy), I am
not managing to do exactly what I need, and I can't find a relevant part in
the FAQs and other tutorials to help me.

I am using qmail on a CentOS 5 VPS powered by PLESK in case it helps.
Mail is delivered to /var/qmail/mailnames/domain/user/Maildir

What I want is to check if spamassassin flagged this mail as spam, and if
so change the delivery destination (a .Spam folder). This bit is easy...
below is the pickle:

My .qmail file was:

| true
| /usr/bin/deliverquota ./Maildir

Now it's:

| true #This comment is not in the qmail file, but just to mention that
the same thing occurs with this pipe present or removed
| preline /usr/bin/procmail -m -o .procmailrc domain user

And my rc file is currently:

#Spam handler
* ^X-Spam-Status: Yes.*
| /usr/bin/deliverquota "$SPAMDIR"
#All other mail
:0 E
| /usr/bin/deliverquota "$MAILDIR"

As you can see, I run it through deliverquota. This works (spam is
filtered correctly and mail is delivered) until I go over the quota.
Usually, the message would be bounced back saying the the mailbox has
exceeded it's limit, but now I get nothing, no mail in my inbox or bounce to
the sender. The message does reach the logs, and is archived by my archiver,
but seems to go no further (it's not in the mailbox at least). Any help?

It seems to me as if procmail ignores deliverquota and delivers. Ideally,
what I want to do is literally just "pass the buck" onto deliverquota and
let it do it's thing, as if it was on the .qmail file, but instead of
"./Maildir", it may have a different value for spam.

Sorry for the long explanation, any help would be appreciated!


procmail mailing list   Procmail homepage:
<Prev in Thread] Current Thread [Next in Thread>
  • Re: Passing mail delivery onto /usr/bin/deliverquota with arguments defined by procmail, Marcus Sykes <=