Hello Filip,

Thank you for your script! I have been looking up several alternative
paths now, and yours seem to be the better way to go.

I had not noticed before that /usr/sbin/sendmail in fact only was a
symlink. I have been testing your script, and it is necessary for me to
modify it. 

This is what I did:
I stored your script on my own local machine, added execute permissions,
and made the symlink /usr/sbin/sendmail point to that file.

I edited the script with the sendmail variable to point to
/etc/alternatives/mta (which points to the true sendmail executable on
all my redhat based systems)

Then I tried to execute the following from command line:

echo -e "test\ntest" | mail -s "test" "[EMAIL PROTECTED]"

that gave the result "2.6/5.0"...

The mail was sent, without any modification, but that's likely because I
did it on the command line. 

Anyway, the script has been of great help, and I will likely have a
filter in place some time next week. 


Best regards,
Kenneth



On Mon, 2005-01-31 at 17:43, Andrzej Adam Filip wrote: 
> 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
> 

Reply via email to