LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-13-2008, 04:46 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Anyone Filter Email w/ Procmail


I am using Postfix to send and receive email on my email server and also have Spamassassin scoring incoming email. I was told that procmail can filter email from Spamassassin into a folder by placing a procmail.rc hidden file in the users home directory to then move mail labeled SPAM in the header into a specific folder. I would love to do this but don't know where to begin on setting something like this up. I am sick of having labeled SPAM in my inbox.
 
Old 03-13-2008, 05:11 PM   #2
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 17
Bung this in a file at ~/.procmailrc
Code:
:0H
*^X-Spam-Status: Yes
$HOME/.spam
:0
$MAIL
Note: It might be necessary to override your local delivery mechanism by also adding a .forward file that contains:
Code:
| /usr/bin/procmail -t
Or, you can change your delivery mechanism to include procmail - see your MTA docs about that.
 
Old 03-13-2008, 05:18 PM   #3
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Postfix will use procmail (they seem to hate it there for some reason), but I use maildrop for the same purpose.

There are a number of ways to do this, one is given above, or a few ways via the transport mechanism. Although for maildrop, I'm sure these would apply for procmail too.

http://www.postfix.org/MAILDROP_README.html
 
Old 03-13-2008, 05:22 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590
Quote:
Originally Posted by Deleriux View Post
$HOME/.spam
AFAIK this isn't a standard location like ~/mail/. Consequence of using this location could result in the filesystem filling w/o users noticing.
 
Old 03-13-2008, 05:23 PM   #5
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
May work for maildir?

Last edited by billymayday; 03-13-2008 at 05:26 PM.
 
Old 03-13-2008, 05:58 PM   #6
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
OK - There is a lot of info here. Let me cap everything up. And by the way I Am using Maildir style, not sure if this makes any difference or not...

1 - I am going to touch ~/.procmailrc as Deleriux suggested.

2 - vim ~/.procmailrc & add what he suggested.

3 - Reload postfix and see if emails that are normally labeled [***** SPAM 6.7 *****] Increase Your Member Size in the subject get filtered w/o having to create a .forward file or adjusting any MTA (Postfix) settings.

Do I need to create ~/.spam or will the .procmailrc file auto generate this for me?

In my /etc/postfix/main.cf, I have the following entry commented out for procmail. Should I enable this setting? Not sure I understand what it does but it seems that it obviously relates to procmail and Postfix.

Code:
carlos@swordfish:~$ cat /etc/postfix/main.cf | grep "procmail"
#mailbox_command = procmail -a "$EXTENSION"

Last edited by carlosinfl; 03-13-2008 at 06:03 PM.
 
Old 03-13-2008, 06:16 PM   #7
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 17
Personaly I dont like procmail as it such a cryptic syntax that isnt suitable for users to exploit. Although I didnt suggest it initially i would recommend as the above poster pointed out to use maildir instead of mbox since it is easier to read and simpler to administrate.
 
Old 03-13-2008, 10:33 PM   #8
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by Deleriux View Post
Personaly I dont like procmail as it such a cryptic syntax that isnt suitable for users to exploit. Although I didnt suggest it initially i would recommend as the above poster pointed out to use maildir instead of mbox since it is easier to read and simpler to administrate.
I am not sure I understand what you mean. I am using Maildir style messaging in Postfix rather than mbox as shown in my config:

Code:
carlos@swordfish:~$ cat /etc/postfix/main.cf | grep "Maildir"
home_mailbox = Maildir/
How does this enable me to filter email that is labeled "SPAM"?
 
Old 03-13-2008, 10:35 PM   #9
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
It was more to do with the procmail rule shown than the ability per se
 
Old 03-14-2008, 10:57 AM   #10
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
So when I enable that comment in my postfix main.cf file, I no longer get email.

Code:
mailbox_command = procmail -a "$EXTENSION"
Should I not be using this option in my main.cf for procmail filtering?
 
Old 03-14-2008, 03:07 PM   #11
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
That looks like the one

Which
Quote:
So when I enable that comment in my postfix main.cf file, I no longer get email.
stops you getting email? If you mean the Maildir one, then mail is being sent to ~/Maildir in maildir format

Last edited by billymayday; 03-14-2008 at 03:09 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
get procmail use a word filter paul_mat Linux - Software 1 09-30-2006 08:00 AM
Procmail filter help. barn63 Linux - Software 11 07-25-2006 02:44 PM
Email filter graveworm Linux - Software 1 07-07-2004 10:39 AM
MS Security Virus Email bypasses Procmail Filter lewt Linux - Security 3 09-24-2003 06:32 PM
Procmail or other filter for outgoing mail gabriele_101 Linux - Software 3 08-18-2003 05:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration