move spam to imap subfolder

Community support for Plesk, CPanel, WebMin and others with insight from two of the founders of Plesk. Ask for help here! No question is too simple or complicated. :-)
zeki
Forum Regular
Forum Regular
Posts: 120
Joined: Sat Aug 12, 2006 8:14 am

move spam to imap subfolder

Unread post 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
biggles
Forum Regular
Forum Regular
Posts: 806
Joined: Tue Jul 15, 2008 2:38 pm
Location: Sweden
Contact:

Re: move spam to imap subfolder

Unread post by biggles »

scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: move spam to imap subfolder

Unread post 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/
}
webrk
Forum User
Forum User
Posts: 11
Joined: Fri May 01, 2009 6:42 pm

Re: move spam to imap subfolder

Unread post 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).
biggles
Forum Regular
Forum Regular
Posts: 806
Joined: Tue Jul 15, 2008 2:38 pm
Location: Sweden
Contact:

Re: move spam to imap subfolder

Unread post by biggles »

Make sure that the files are readable by the Plesk mail user. I think it's "popuser"...
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

Re: move spam to imap subfolder

Unread post 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.
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
webrk
Forum User
Forum User
Posts: 11
Joined: Fri May 01, 2009 6:42 pm

Re: move spam to imap subfolder

Unread post 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?
Post Reply