Kenneth Andresen wrote:
How is it possible to make such a sendmail wrapper script? Any links to
examples?

No but you can modify the script below to fit your needs:

#!/bin/sh
# temporary directory
TMPDIR=/tmp
# temporary working file name - unix time and process ID
TMPFILE=`/bin/date +%s`.$$
# temporary working file full path
TMPPATH="$TMPDIR/$TMPFILE"
# "true" sendmail path
SENDMAIL=/usr/sbin/sendmail
# directory to keep "classified as spam" messages
QUARANTINEDIR=/var/spool/quarantine

# remove temporary file in case of problems
trap "rm -f $TMPPATH" 0 1 2 3 15

# copy input to temporary file
cat - > $TMPPATH
# use spamc to check if it is a spam
spamc -c < $TMPPATH

if [ "$?" = "0" ] ; then
  # No spam or spamc error
  $SENDMAIL "$@" < $TMPPATH
  EXITCODE=$?
  rm $TMPPATH
  exit $EXITCODE
else
  # classified as spam
  mv $TMPPATH $QUARANTINEDIR/$TMPFILE
  echo "$@" > $QUARANTINEDIR/$TMPFILE.options
fi


-- Andrzej [en:Andrew] Adam Filip [EMAIL PROTECTED] [EMAIL PROTECTED] Home Page http://anfi.homeunix.net/

Reply via email to