procmail
[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:
http://blog.netweblogic.com/linux/mail/filter-spam-folder-procmail-qmail-plesk/

Best,
Marcus

On Thu, Jan 15, 2009 at 12:37 PM, Marcus Sykes 
<procmail(_at_)netweblogic(_dot_)com>wrote:

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/
erecovery.ws/admin/Maildir"
procmail: Assigning
"SPAMDIR=/var/qmail/mailnames/erecovery.ws/admin/Maildir/.Spam/"
procmail: No match on "^X-Spam-Status: Yes.*"
procmail: Executing
"/usr/bin/deliverquota,/var/qmail/mailnames/erecovery.ws/admin/Maildir"
procmail: Assigning "LASTFOLDER=/usr/bin/deliverquota
/var/qmail/mailnames/erecovery.ws/admin/Maildir"
From test(_at_)domain(_dot_)com Thu Jan 15 11:33:21 2009
 Subject: Quota Test
 Folder: /usr/bin/deliverquota /var/qmail/mailnames/erecovery.ws/admi
 62598


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

#Spam handler
:0
* ^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:
MAILDIR=/var/qmail/mailnames/$1/$2/Maildir
SPAMDIR=$MAILDIR/.Spam/

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....

-Charles


On Wed, Jan 14, 2009 at 2:57 PM, Marcus Sykes 
<procmail(_at_)netweblogic(_dot_)com>
wrote:

Hello,

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:

MAILDIR=/var/qmail/mailnames/$1/$2/Maildir
SPAMDIR=$MAILDIR/.Spam/
#Spam handler
:0
* ^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!

Thanks,
Marcus

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>
  • Re: Passing mail delivery onto /usr/bin/deliverquota with arguments defined by procmail, Marcus Sykes <=