I'm having a strange issue with vpopmail and maildrop.  I'm running a spam
scanner called spamprobe.  Attached is the maildrop filter itself, and my
qmail-default file looks like this (all one line):

| /var/qmail/bin/preline /usr/local/bin/maildrop
/var/vpopmail/etc/maildroprc-spamprobe

The problem I'm running into happens after a message has been marked as
spam.  Basically, the jist of the filter is that if the message is larger
than 262144 bytes it is scanned.  If a message is scanned and marked as
spam, it's delivered to a .SPAM folder inside their Maildir which is then
readable via IMAP.  But, the problem I'm encountering is when a message is
marked as spam and to an invalid recipient, it goes to deliver to the .SPAM
directory of a user that doesn't exist.  When maildrop has a problem
delivering it exits with a EX_TEMPFAIL, which puts the message back in queue
for delivery later.  The message just sits in queue until finally qmail
bounces back saying it's been in queue too long.

To try and combat this problem, I had maildrop run a test to make sure that
the ~vpopmail/domains/iswest.net/user/Maildir existed, and if it didn't to
pipe the message to vdelivermail and exit.  This is where the weirdness
comes in.  Sometimes, and I can't figure out how to reproduce it, vpopmail
exits back to maildrop with a 0 error code so maildrop considers the message
delivered and it bounces back to the sender with the "no mailbox here by
that name" error.  Other times though, I get this in my log files:


@400000003ee220592b6202ac status: local 6/10 remote 1/120
@400000003ee220592b6788bc delivery 1708886: deferral:
Sorry,_no_mailbox_here_by_that_name._vpopmail_(#5.1.1)/maildrop:_error_writi
ng_to_mailbox.//usr/local/bin/maildrop:_Unable_to_deliver_to_mailbox./
@400000003ee220592c32432c status: local 5/10 remote 1/120
@400000003ee220592c3275f4 delivery 1708888: deferral:
Sorry,_no_mailbox_here_by_that_name._vpopmail_(#5.1.1)/maildrop:_error_writi
ng_to_mailbox.//usr/local/bin/maildrop:_Unable_to_deliver_to_mailbox./
@400000003ee220592c32bc44 status: local 4/10 remote 1/120
@400000003ee220592c32df6c delivery 1708889: deferral:
Sorry,_no_mailbox_here_by_that_name._vpopmail_(#5.1.1)/maildrop:_error_writi
ng_to_mailbox.//usr/local/bin/maildrop:_Unable_to_deliver_to_mailbox./

I've had this same problem with vpopmail 5.3.8 and I just tried upgrading to
5.3.20 this morning but I still see the same things in the log files.  I am
not able to reproduce this myself, so I have no idea exactly why it happens,
but any input on this would be greatly appreciated.
##############################
mailfilter
##############################
import EXT
import HOST
import HOME
VHOME=`/var/vpopmail/bin/vuserinfo -d [EMAIL PROTECTED]
VPOP="| /var/vpopmail/bin/vdelivermail '' bounce-no-mailbox"

# messages larger than X bytes are not scanned
if ($SIZE < 262144)
{
        # message is scored and automatically added to the filter
        #SCORE=`/usr/local/bin/spamprobe -d /var/spool/spamprobe -s 500 receive`

        # message is scored but not added to the filter
        SCORE=`/usr/local/bin/spamprobe -d /var/spool/spamprobe -s 500 score`

        # header added to the email based defining it's score
        xfilter "/usr/local/bin/reformail -i 'X-SpamProbe: $SCORE'"
}

# if the score is marked as "SPAM" it is delivered to a .SPAM dir
if ((/^X-SpamProbe: SPAM/:h))
{

   # check to see if user even exists, if not, send to vpopmail to boucne it
   `test -d $VHOME/Maildir/`
   if( $RETURNCODE == 1)
   {
   to "$VPOP"
   }

   # make sure the Maildir/.SPAM dir exists, if not, create it
   USER="vpopmail"
   GROUP="vchkpw"
   `test -d $VHOME/Maildir/.SPAM`
   if( $RETURNCODE == 1 )
   {
   `/usr/local/bin/maildirmake $VHOME/Maildir/.SPAM ; /usr/sbin/chown -R $USER:$GROUP 
$VHOME/Maildir/.SPAM`
   }

   # deliver spam to Maildir/.SPAM dir
   to "$VHOME/Maildir/.SPAM/"

   # find old spams and delete them
   `find $VHOME/Maildir/.SPAM -type f -mtime +7 -delete`
}

# everything else delivered normally
to "$VPOP"

Reply via email to