[vox-tech] spamassassin + procmail
ME
vox-tech@lists.lugod.org
Sat Jun 5 17:32:17 PDT 2004
Milver S. Nisay said:
> hi guys,
> i am trying to call a shell script before SENDMAIL will deliver a mail
> message,
> can it be done using procmail ? if so, any hints?
> can anyone advise me on this. thanks in advance.
> //milver
>
This may be of some help. Here is a generic Template with some basic vars
as used in a .procmailrc to get you started:
(You can see several examples of prgrams being called from the script and
you should be able to find a way to work one of these into call a prgram
at a specific time in processing of a message.)
(If you find you have problems, you can always create a "wrapper" script
which includes a "cat" and a subsection which does other things. Then when
you pipe things through this script, it spits out what it gets, *and* does
your extra "sub commands" when it is called. (one of those interesting
tricks I have used.)
----------------cut after this line --------------
#Set on when debugging settings
VERBOSE=off
#How to "run" things we call:
SHELL=/bin/bash
#Path for Shell:
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
#Dynamic username loading:
USER=`whoami`
#If you use "MailDir" format, make sure the path to the mail
# storgae ends with a "/"
#If you are using mbox, then make sure it sends without a "/"
#Your mail directory
MAILDIR=/home/${USER}/Maildir
#MAILDIR=Maildir/
# optional:
DEFAULT=${MAILDIR}/
#recommended:
LOGFILE=$MAILDIR/LOG
# Include user-specific files:
#INCLUDERC=/var/whatever/${USER}-spamrc
# I have an alias for abuse reports of spam to me:
# If "to" a user, put in one folder:
:0 H
* ^To:.*spam@passwall.com
.aSysSpam/
# Many ways to do this:
# If message size is less than 356kB, then call pipe message through
# program: (SpamAssassin has a feature for this too)
:0fw
* < 256000
|/usr/local/bin/spamc -f
# If marked as sam, put in spam maildir:
:0 H
* ^X-Spam-Status: Yes
.SPAM/
# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped. This will re-add it.
:0 H
* ! ^From[ ]
* ^rom[ ]
{
LOG="*** Dropped F off From_ header! Fixing up. "
:0 fhw
| sed -e 's/^rom /From /'
}
#Our default catch-all:
:0
${MAILDIR}/
--------------------cut above here-----------------
HTH,
-ME
More information about the vox-tech
mailing list