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 08-07-2006, 09:41 PM   #1
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Rep: Reputation: 31
procmailrc filter groups?


Can anyone tell me if there is a way to group filters without having to split each individual filter into a file?

Right now I just use the standard .procmailrc file and some filters go to a mailbox and some to anther mailbox and some that to go the bit bucket.

My issue is that I have to creat a separate entry for each filter even though its going to the same place.

Example:

:0
* ^From.*@cs\.com
/dev/null

:0
* ^From.*@promotionalaprons\.com
/dev/null

Is there a way that I can combine thse to so that I can just keep adding to the entry.

Something to the effect of (but I know is probably wrong):

:0
* ^From.*@cs\.com
* ^From.*@promotionalaprons\.com
/dev/null

Any suggestions are appreciated..

Last edited by lmcilwain; 08-08-2006 at 05:08 PM.
 
Old 08-08-2006, 04:57 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Something to the effect of (but I know is probably wrong)
No it isn't wrong. If the destination is the same you can group all sorts of filter criteria, just like you showed.
 
Old 08-08-2006, 05:10 PM   #3
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
Alright, I will give that a shot... I didn't realize it was as simple as listing each criteria right under each other like that was ok. My first impression of that is that the filter would be looking for all criteria to be met betwen :0 and /dev/null before it would attempt to place filter it properly.
 
Old 08-08-2006, 05:58 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Alright, I will give that a shot..
If you're going to experiment you best set stuff like VERBOSE=on and LOG=/some/file in your resource file and test it with delivered email. Save this as procmailtest.rc:
Code:
VERBOSE=on
LOG="$HOME/procmailtest.log"

:0
* ^From.*@cs\.com
* ^From.*@promotionalaprons\.com
$HOME/mail/thrashcan
Now open up your mailbox in vi or any text editor and cut a single message to file (say procmailtest.msg) to make sure you preserve all headers. Change the "From:" header if necessary. Now run it like this:
Code:
cat procmailtest.msg 2>&1|formail -s 2>&1|procmail -m procmailtest.rc 2>&1 | tee procmailtest1.log
Now procmailtest.log and/or procmailtest1.log should show delivery info w/o you fscking up already working email delivery ;-p


the filter would be looking for all criteria to be met betwen :0 and /dev/null before
Procmail also has two often overlooked man pages: procmailrc and procmailex...
 
Old 08-08-2006, 08:24 PM   #5
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
I don't recall if I have verbose on or but I didn't turn the log on (Which I should have done)but created a test .procmail file to replace my original (of course after making a backup).

I grouped one of the filters that I know gets used a lot to see how it would work and it didn't work. The messages came to my inbox instead of the mailbox that I had it filtered to. I will give it another shot tomorrow and turn the log on so I can paste log info if its relevant.

I did take another look at google and it looks like procmail uses pipes to separate individual filters that go to the same inbox. Here is the snipet I got from a site:

--------------------
# put any mail from newdream or dreamhost in the folder 'junk'
# (we don't recommend that you actually use this one, of course)
:0
* ^From:.*(newdream\.net|dreamhost\.com)
.junk/

Last edited by lmcilwain; 08-08-2006 at 08:31 PM.
 
Old 08-09-2006, 08:43 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
You're right. Filtering using multiple rules depend on the return value of the one before, so if the first one doesn't match then the rest is skipped, so the stringing together (newdream\.net|dreamhost\.com) should work but maybe better use spamassassin.
 
Old 08-09-2006, 09:58 PM   #7
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
Ok, I will check out spamssassin and see how that works. Stay Tuned...
 
  


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
Map Windows NT Groups to UNIX Groups - why? kenji1903 Linux - Networking 4 10-16-2007 11:52 AM
.procmailrc jayakrishnan Linux - Networking 0 11-19-2005 02:13 AM
procmailrc filter for alias skyfly Linux - Security 1 05-19-2005 04:48 AM
Spam filter to external mail filter deadlock Linux - Software 1 06-16-2004 02:28 AM
winbind: wbinfo -g only lists global groups from PDC and not local groups saradiya Linux - Networking 0 12-01-2003 02:58 AM

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

All times are GMT -5. The time now is 10:20 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