At 12:09 2002-06-12 -0500, Nick Gray did say:
Total newbie to procmail. Despite the fact it has been on my Linux boxes
for awhile, I never did anything with it before.
Don't laugh at my first script. (It took me several hours to get this
straight)
VERBOSE=off
:0
* ? formail -x"From" | egrep -is -f RejectFrom #Match mail that
comes from values in RejectFrom file
{
DATE=`date +%Y%m%d%H%M%S` # Date in Zulu format
REASON=`formail -c -xFrom:` # Since we are
looking at "From" show why it failed
SPAMLOG=/var/log/procmail/rejected-mail # Log to be
emailed and cleaned once a day using the Linux util
:0 #Make the log entry
*
A "no condition" is achieved by simply having no condition line - have the
delivery immediatley follow the flags.
|echo "$DATE:Rule RejectFrom:Reason$REASON" >> $SPAMLOG;
:0 #Toss the message
*
/dev/null
Once delivered, it doesn't need to be thrown away. The issue is that the
pipe to echo doesn't READ the message, and therefore procmail sees it as a
delivery failure. Add the 'i' flag (see 'man procmailrc') to the logging
line, and you can eliminate the discard delivery.
I wanted something I could mail at the end of the day and let me know how
my rules were working.
I emit elements to my regular procmail log, and have a simple script
invoked by crontab that grabs the ^SPAM: lines and emails them.
I am a little unclear as to what need in my sendmail.mc file to make sure
that all traffic is being filtered.
One set of instructions indicates this
#
LOCAL_RULE_0
R$*<@$=w>$* $#procmail $@/etc/procmail/filter.rc $:$1<@$2.procmail.>$3
Rather than creating ANOTHER dir which may be easily confused for that due
to the similarity, you probably want /etc/procmailrcs/filter.rc -- procmail
treats /etc/procmailrcs special (it assumes the uid of the file owner, when
directly invoked on the file). If all the files are owned by root, no
problem, since generally invoking procmail as a filter from within sendmail
would have it invoked as root user anyway.
My actual config has this in it
You mean in your M4 config file. Your "actual" config would be the
sendmail.cf that is "actually" used.
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
Why are you adding -t ?
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
MAILER(procmail)dnl
I am thinking that the stuff that is in the config file causes procmail to
be the LDA
MAILER(procmail) isn't necessary for using procmail as LDA. It is
unrelated - it has to do with being able to deliver "to" procmail much as
you deliver "to" a file or to SMTP.
Doesn't this also cause all mail going through the MTA (Sendmail) to be
filtered.
No, LDA is only for mail being delivered to local _USERS_. Delivery to
aliases (to programs, or to remote users, or lists of same), as well as
outbound delivery, are not subject to handling by the LDA.
Therefore I don't need the LOCAL_RULE_0.
Refer to the Sendmail Bat book, 19.6.32. LOCAL_RULE_0 is not synonymous
with LDA.
Also since procmail is using the /etc/promailrc file. I am thinking the
best thing to do is create an /etc/procmail direcotry and create all of my
recipes in there with the .rc extension and include them into the
/etc/procmailrc file.
Procmail treats /etc/procmailrcs/ special - see the manpage. No need to
create a similar directory there which may be cause for later
confusion. Yes, I put global recipe components into /etc/procmailrcs and
include them into the /etc/procmailrc script.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail