LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-30-2004, 06:30 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Rep: Reputation: 54
procmail filters?


I realize these are very complicated, I just can't figure out how to do one simple thing.

I have spamassassin on my server, and also an imap server which is setup with squirrelmail. Most users have a spam folder, so I want all mail that is labeled as [spam] in the title to go in the spam folder of each user.

So if mail sent to user1 is marked with [spam] in the title, then it will go in that user's spam folder.

Can someone show me how to set this up? I searched google like crazy but all sites show a different way and all of them don't work.

Thanks in advance.
 
Old 11-30-2004, 08:51 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
i guess you use procmailrc either a universal one with a variable that can account for each user or just use
~/.procmailrc in each user home dir
this may or may not help -- i give you the spammassassin part of my ~/.procmailrc
(i don't use imap !) so i don't know about that -- mine is going into a spam file in my ~/mail folder where pine can see it. possibly you can adjust
Code:
:0fw:spamassassin.lock
| spamassassin :0e

  EXITCODE=$?
:0:
* ^X-Spam-Flag: Yes
$HOME/mail/spam
 
Old 11-30-2004, 09:13 PM   #3
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
Yeah I tried it, no luck.

I put in /home/email_redsquirlrel/.procmailrc:

* ^X-Spam-Flag: Yes
/home/email_redsquirrel/spam

The spamassassin stuff is in the global file which is in /etc/procmailrc
 
Old 11-30-2004, 09:20 PM   #4
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
btw what is the ~ mean? Do I need to actually create a folder called that and put the .procmail file in it? maybe that's why it's not working.
 
Old 12-01-2004, 02:39 AM   #5
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
'~' is the user's home directory path.

-twantrd
 
Old 12-01-2004, 06:14 PM   #6
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
Oh I see... I still can't get this filter thing to work though. It's really driving me nuts that it's this complicated.
 
Old 12-01-2004, 08:21 PM   #7
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
Well I might of broke down the problem slightly.

I took off the spamassassin part and now it seems to work - well obviously not the filtering for spam, but filtering in general, since I just used webmin to set a filter to append all mail to a file, and without the spamassassin part being present it does append properly. BUT I want to be able to run spamassassin THEN append to a file only IF spamassassin set the mail as spam. So this is where it's complicated since I assume it's not possible without some intensive config file programming of some sort.

Also when it appends to a file it still sends it to the inbox, so it basically just duplicates it. But before solving that problem I want to make this work even with spamassassin. And I want spamassassin to run first, otherwise it defeats the purpose of the filter.
 
Old 12-02-2004, 12:40 PM   #8
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
'bump' for great justice
 
Old 12-02-2004, 06:58 PM   #9
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
Ok I figured out how to make it produce a log.

So I have a filter to move anything with [SPAM] in the subject to the mail filter, that filter is in the user's .procmailrc, since once I can figure this out I will set the appropriate one in each user.

Then in the global .procmailrc I have run spamassassin.

This is how the log looks like when spamassassin is run:

Code:
procmail: Executing "/usr/bin/spamassassin"
procmail: [23633] Thu Dec  2 19:40:23 2004
procmail: Assigning "PATH=/home/email_redsquirrel/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin"
  Folder: /var/spool/mail/email_redsquirrel
As you can see it completly ingores the filter to put everything with [SPAM] in the right folder.

In fact I think it's caused by the fact that the date is on it's on line, it's probably that which is screwing things up, I don't even know what the date is doing after that.


If I comment out spamassassin and send an email with [SPAM] in the title:

Code:
procmail: Assigning "PATH=/home/email_redsquirrel/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin"
From redsquirrel@iceteks.com  Thu Dec  2 19:51:43 2004
 Subject: [SPAM] test
  Folder: /home/email_redsquirrel/spam
The rule works.

So what's up with this? Why is it that if a program is executed, that it ingores the rest of the rules? I tried spamc since I've seen some configs use that, but when I use that it simply does not work period, it does not filter for spam. So I need to use spamassassin.

So please if someone can help me it would be apreciated. This is really bugging me big time, that something this simple, is this complicated and hard to do.
 
Old 12-02-2004, 10:50 PM   #10
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
I forgot to mention I'm running spamassassin 2.31, is this version too old to work with procmail? Maybe that's my problem... do I need to upgrade?
 
Old 12-03-2004, 11:42 PM   #11
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Original Poster
Rep: Reputation: 54
Ok, well I finally figured it out after almost a whole week. I'll post my solution since it's not really obvious.

spamassassin 2.3 is NOT compatible with procmail. The reason apears to be because 2.3 does not output the modified email when it is passed through. So spamassassin <email.txt WILL NOT output the new email. Procmail requires this in order to continue, instead what was happening was that spamassassin took over and delivered the mail after it was done scanning, instead of continuing in procmail. So this is why all the rules I set after were ingored.

So I upgraded to spamassassin 3.0, had a bit of trouble because some default rules made it so it accepts all spam, but I managed to get rid of those default rules and then I had to put rewrite_header Subject (_SCORE_) [SPAM] instead of the old 2 rewrite lines then everything went uphill from there, so I created the .procmail files for all the other users, and now it's smooth. the server seems slow but it's probably because I had cron shutdown during this 2-3 hour upgrade to ensure nothing gets lost. (cron controls fetchmail which gets my mail every 15 minutes) So now cron is just catching up with everything.

So long story short, if procmail rules set after spamassassin don't work, upgrade spamassassin.

Last edited by Red Squirrel; 12-03-2004 at 11:44 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with mail delivery procmail>cyrus imap (using sendmail,procmail,cyrus,imap) bwana Linux - Software 2 03-24-2005 07:01 PM
regarding filters zameer_india Linux - Newbie 1 02-05-2005 03:47 AM
procmail before milter filters in sendmail mussons Linux - Software 0 12-15-2003 08:25 AM
kmail and filters thllgo Linux - Software 0 09-26-2003 09:00 AM
Spam Filters loom001 Linux - Software 0 06-23-2003 10:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration