LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-06-2006, 09:11 AM   #1
alesz
Member
 
Registered: Mar 2005
Distribution: FC5 on disk, Knoppix as LiveCD
Posts: 48

Rep: Reputation: 15
procmail won't remove spam from fetchmail'ed mail


I have set up fetchmail to fetch my mail from various mail servers to my desktop computer.
Mail gets delivered just fine, but I can't manage to persuade procmail to remove messages, marked as SPAM.

Probably mail isn't run trough procmail to filter it, i don't know. I've read several posts and tried couple of configurations, but I cannot manage to figure it out. My .forward file:
Code:
$ cat .forward
|/usr/bin/procmail
Procmail configuration file:
Code:
cat .procmailrc
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin
MAILDIR=$HOME/Mail      #you'd better make sure it exists
DEFAULT=$MAILDIR/mbox   #completely optional
LOGFILE=$MAILDIR/from   #recommended

:0fw
| /usr/bin/spamassassin

:0
* ^Subject:.*SPAM*
/dev/null

:0
* ^Subject:[Spam*
/dev/null
My fetchmail configuration:
Code:
$cat .fetchmailrc
#set filter = /usr/bin/procmail -m $HOME/.procmailrc

set daemon 300
poll [server removed] with proto POP3
    user [user removed] there with password [pass removed] is ales here

poll [server removed] with proto POP3
    user [user removed]there with password [pass removed]is ales here

poll pop.gmail.com with proto POP3
    user [user removed]there with password [pass removed]is ales here
Google mail isn't delivered also, but that's another problem.
Can anyone tell, what could be wrong?
 
Old 06-06-2006, 10:21 AM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Quote:
Originally Posted by alesz
Probably mail isn't run trough procmail to filter it, i don't know.
Check your LOGFILE. I send mail through SpamAssassin using spamc (less CPU intensive). I don't let SpamAssassin change the subject line, so I check for the presence of an "X-Spam-Flag" header instead:
Code:
:0:
* ^X-Spam-Flag:
$HOME/Spam
One more thing. The procmail matches regular expressions, in which '*' and '[' are metacharacters. So, for example, if you want to match "*SPAM*" in the subject line, your recipe would need to be
Code:
:0
* ^Subject:.*\*SPAM\*
/dev/null
 
Old 06-08-2006, 12:13 PM   #3
alesz
Member
 
Registered: Mar 2005
Distribution: FC5 on disk, Knoppix as LiveCD
Posts: 48

Original Poster
Rep: Reputation: 15
I tried what you suggested, thanks, but it does not work.

First I tought this worked, but I am sorry, this does not work.

How could I even check, that procmail is run after mail is received? Which "LOGFILE" did you mean?
 
Old 06-08-2006, 01:06 PM   #4
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
As per your .procmailrc, LOGFILE=$MAILDIR/from

You can also check /var/log/maillog, or whatever file your MTA logs to. For example, with Postfix, you'll have a line like this
Quote:
Jun 7 10:52:01 galois postfix/local[3213]: 1EC4218C35: to=<berhanie@example.com>, orig_to=<berhanie>, relay=local, delay=1, status=sent (delivered to command: /usr/bin/procmail)
Whereas, if mail isn't going through procmail, you'll have a line such as
Quote:
Jun 8 11:12:54 galois postfix/local[3227]: E411F18C35: to=<berhanie@example.com>, orig_to=<berhanie>, relay=local, delay=1, status=sent (delivered to mailbox)

Last edited by Berhanie; 06-08-2006 at 01:16 PM.
 
Old 06-08-2006, 01:13 PM   #5
alesz
Member
 
Registered: Mar 2005
Distribution: FC5 on disk, Knoppix as LiveCD
Posts: 48

Original Poster
Rep: Reputation: 15
Oh sorry, I see. But LOGFILE was not even created (mbox) in Mail/.
But I still don't know how to solve the problem. Does someone know about some gool tutorial that would work for FC5, as here apps are already installed/yum'med, so i'd need bare instructions?
 
  


Reply



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
Procmail: forwarding mail to remote mail account Cadmium Linux - Software 2 01-14-2010 01:05 PM
How to use Procmail to deliver spam to different mailbox? Maarten_Holland Linux - Software 2 05-22-2006 08:10 AM
procmail and spam -- do not send out of office auto replay to spam draix Linux - Software 0 12-30-2004 08:35 AM
spamassassin tags spam while procmail isn't running broxtor Linux - Software 1 10-13-2004 02:57 PM
Remove attachments with Procmail? ciop Linux - Security 3 06-09-2004 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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