Page 1 of 1

move spam to imap subfolder

Posted: Tue Mar 31, 2009 7:57 am
by zeki
hello
since plesk9 and 4psa spamguardian spamguardian runs in another mode and i dont have the option to move spam tegged mails to a subfolder.

its possible to do that with qmail-scanner or other rpms on asl easy for every user on the server?

thanks
zeki

Re: move spam to imap subfolder

Posted: Tue Mar 31, 2009 8:23 am
by biggles

Re: move spam to imap subfolder

Posted: Tue Mar 31, 2009 8:36 am
by scott
An addition to that thread, this is how I do it with mailfilter instead of procmail:

cat .qmail
| true
|/usr/bin/maildrop .mailfilter


cat .mailfilter
if ( /^Subject:.*\*\*\*\*SPAM\*\*\*\*/ )
{
to ./Maildir/.Spam/
}

Re: move spam to imap subfolder

Posted: Sun May 03, 2009 12:33 pm
by webrk
scott wrote:An addition to that thread, this is how I do it with mailfilter instead of procmail:

cat .qmail
| true
|/usr/bin/maildrop .mailfilter


cat .mailfilter
if ( /^Subject:.*\*\*\*\*SPAM\*\*\*\*/ )
{
to ./Maildir/.Spam/
}

Hi,

I have tried exactly this but when I modify the 2 files mails stops being delivered to my Inbox, or Spam folder. I am not sure what I am doing wrong... Doesn't anyone know where I can look to find out what is going wrong?

If I put the contects of .qmail back to:

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

Everything works fine (except the spam is not being filtered).

Re: move spam to imap subfolder

Posted: Sun May 03, 2009 2:28 pm
by biggles
Make sure that the files are readable by the Plesk mail user. I think it's "popuser"...

Re: move spam to imap subfolder

Posted: Sun May 03, 2009 2:40 pm
by faris
Also make sure you have the maildrop rpm installed!

In case it helps anyone:

The contents of .qmail should be as follows:

| true
|/usr/bin/maildrop .mailfilter

This says when you get incoming mail, run maildrop and look at the commands in .mailfilter

The contents of .mailfilter should look something like this:

if ( /^Subject:.*\*\*\*\*SPAM\*\*\*\*/ )
{
to ./Maildir/.Spam/
}

Except 4psa SpamGuardian looks at a folder called junk_learn, not Spam.

So you really need it to look like this:

if ( /^Subject:.*\*\*\*\*SPAM\*\*\*\*/ )
{
to ./Maildir/.junk_learn/
}

You also need to make sure that the Subject line matches what you have set in SpamGuardian. Remember that the if () line is a regular expression. In the example above, it is expecting FOUR "*"s. If you have set it differently, you'll need to modify that.

And just as biggles says, you need the files to be popuser.popuser and definitely not root.root.

Faris.

Re: move spam to imap subfolder

Posted: Mon May 04, 2009 4:17 pm
by webrk
I'm definitely doing something wrong :-(.

Maildrop is installed:

# yum list maildrop
fedora 100% |=========================| 2.1 kB 00:00
atomic 100% |=========================| 951 B 00:00
primary.xml.gz 100% |=========================| 136 kB 00:00
atomic : ################################################## 374/374
freshrpms 100% |=========================| 2.1 kB 00:00
updates 100% |=========================| 2.3 kB 00:00
Installed Packages
maildrop.i386 2.0.4-7.fc7.art installed

***

The two files are in the correct place with the correct owner/permissions:

-rw------- 1 popuser popuser 53 may 3 18:11 .mailfilter
-rw------- 1 popuser popuser 41 may 3 18:16 .qmail

***

Subject line of typical spam message:
****SPAM**** HIGH * Acai Diet, lose weight without gadgets or joining expensive programs

***

Contents of .mailfilter:

if ( /^Subject:.*\*\*\*\*SPAM\*\*\*\*/ )
{
to ./Maildir/.Spam/
}

***

Contents of .qmail:

| true
|/usr/bin/maildrop .mailfilter

***
(even tried it with the space after the second "|", neither worked)

| true
| /usr/bin/maildrop .mailfilter

***

If this is set up, when I send an email to myself it never gets delivered. If the .qmail file is like this:

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

all mail goes straight to my inbox (spam included).

Anyone know what logs I can look at to see why maildrop isn't delivering the mail as expected?