LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Sorting mail into folders? (https://www.linuxquestions.org/questions/linux-software-2/sorting-mail-into-folders-112614/)

cli_man 11-05-2003 07:08 AM

Sorting mail into folders?
 
I have just gotten spamassassin working on one of my servers and it is working great, I have it for right now just changing the title of the messages to [SPAM] so I can see which ones it is marking. What I would like to do now is have any messages it marks as spam be put into a spam imap folder. All the users on this server are using squirrelmail to check their mail so haveing a spam folder would be ideal. My problem is I do not know where to start on doing that, which program would do the sorting?

These are the programs I am useing for mail

qmail
vpopmail
courier-imap
qmail-scanner
clamscan
spamassassin

At first I thought that spamassassin should do the sorting into different folders but now I don't think it is its job but what program is it that would do that?

Can any of the above programs sort any messages with [SPAM] in the title to a spam mailbox for that user? And how would I do that?

nhs 11-05-2003 07:38 AM

At some point your setup will call procmail. Edit your ~/.procmailrc file to a spam folder when the headers match 'Subject: .*\[SPAM\].*'. You will need to read the procmailrc man page as I can't remember the precise syntax at the moment.

cli_man 11-07-2003 09:43 AM

Thank you for your response, I have spent the last couple of days trying to get it all to work together. I finally got it to work and wanted to reply back with how I did it as this seems to not be very documented on the web.

I setup my mail server very similar to the guide here:
http://www.pipeline.com.au/staff/mbo...ail-server.htm

I did the spamassassin and clam antivirus checking, this was working very good for finding the messages that were spam but I wanted to filter any message that started with [SPAM] into a spam imap folder.

I am useing vpopmail so it is not the regular setup but I used procmail like was said above and put the following two files in.

/home/vpopmail/goober.com/marcus/Maildir/procmailrc

The contents were:
Code:

### Spam Assassin
:0fw
| /usr/bin/spamassassin -P

:0e
{
  EXITCODE=$?
}

### Toss Spam into a Folder
:0:
* ^Subject:.*\[SPAM\].*
/home/vpopmail/domains/goober.com/marcus/Maildir/.spam/

### Deliver the rest into Maildir normally
:0
*
/home/vpopmail/domains/goober.com/marcus/Maildir/

And then I called that file from the following file:
/home/vpopmail/domains/goober.com/.qmail-marcus

The contents of that file were:
Code:

| preline procmail -t /home/vpopmail/domains/goober.com/marcus/Maildir/procmailrc
After I made those two files it now sorts all the messages marked as spam to the spam imap folder. Now my next project is to delete any messages that are over 7 days old in that spam box from a cron job. If I get that I will post that here as well.

evil_Tak 11-07-2003 10:02 AM

If you're using courier-imap, you're probably also using courier maildrop? If so, maildrop has a builtin facility for filtering based on per-Maildir config files.

I have a similar setup - postfix+courier-imap+courier-maildrop, and several of my users use my squirrelmail interface. (I don't really have any custom spam checkers, because my global maildrop filter catches 99% of the spam anyway.)

cli_man 11-07-2003 10:20 AM

I may find a better way of doing it, but for now that will do the job, I am going to program a custom interface later where users can set their spam settings, and a bunch of stuff but until then I will just do it the way I said above.

This project started out as just scanning for virus's but when I was looking it looked like I could also do spam filtering with just a little more setup so I went for the whole thing.


All times are GMT -5. The time now is 05:33 AM.