[prev in list] [next in list] [prev in thread] [next in thread] 

List:       procmail
Subject:    Re: Attempting to use procmail as a general filter in sendmail.cf
From:       Philip Guenther <guenther () gac ! edu>
Date:       2000-05-14 0:17:58
[Download RAW message or body]

Tom Leach <leach@oce.orst.edu> writes:
>Hello, not sure if this is a procmail problem or a sendmail one, but I'm 
>trying to set up a sendmail.cf file on a department mail server
>that will have a rule that calls procmail to run a filter in in/out bound
>mail.  I'm generally trying to reduce SPAM by looking at the subject lines
>and if they match the filter, toss the message into a file for scanning
>later.
>
>I guess I'm checking to see if setting up a rule is a good approach.  I'd
>rather not replace the local mailer with procmail (that just sounds like 
>to major of an operation), but I didn't know if I was on the right track 
>or not...

Replacing the local mailer is conceptually simpler than what you're doing.


>Here's what I've tried so far:
>This setup seems to work on a test system, but I wanted some assurances
>before dropping it on the main mail server...
>Solaris 2.6, sendmail 8.9.3, procmail 3.14
>
>in sendmail.cf, first line of rule 0:
>R$*                     $: $>99 $1              do procmail checks
>
>in sendmail.cf, created rule 99:
>###################################################################
>###  Ruleset 99 -- procmail part of ruleset zero (can be null)  ###
>###################################################################
>
>S99
>R$*.procmail$*         $@ $1$2         # procmail has already looked at this.
>R$*<@$+>$*             $#procmail $@/etc/mail/procmail.rc $:$1@$2procmail


The user specification is incorrect on the second rule: you're missing
the brackets, the period before "procmail", and $3 (without $3 all route
addresses would be completely hosed).  I would also suggest being more
explicit in what you're expecting to match with the first rule:

S99
R$*<@$+.procmail>$*	$@ $1<@$2>$3	# procmail has already looked at this.
R$*<@$+>$*		$#procmail $@/etc/mail/procmail.rc $:$1<@$2.procmail>$3

That should make it more clear what is going on.


...
>In /etc/mail/procmail.rc:
>:0
>* ^Subject: Make Money Fast
>/var/log/SPAM
>
>:0
>! -oi -f "$@"


When you save the message to /var/log/SPAM you're losing the envelope
address info.  You should save it in a header:

	SENDER = $1
	RECIPT = $2
	:0:
	* ^Subject: Make Money Fast
	|formail -I"X-Envelope-Addressing: $SENDER $RECIPT" >>/var/log/SPAM


and no, you can't just place $* or $@ in the quotes, because the above
will be executed by the shell.  $@ wouldn't be correct anyway (it would
create more arugments for formail) and procmail doesn't expand $*.


Philip Guenther

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic