So I had some issues getting PDF's through spamassassin the other week.
I had some emails with rather large (8MB+) PDF attachments that seemed
to completely bog my mail-server down. 

Wess had given me the advice:

"You shoud probably set your MTA to skip spam assassin when a message is
over a certain size, like 200kb."

So I set out to do this...

Since I am not using qmail-queue to scan every message that enters my
server but do it on a per user basis, I figured I'd better take a look
at ifspamh. So I open it up in VI and notice that the file checking
logic in this script occurs AFTER mail gets checked by spamd. This
didn't seem *right* to me so I altered my local version of the script in
such a way that it checks the file size prior to sending the mail
through spamd. My new code is:

if [ -z "$FORWARD" ]; then
  echo "Usage: ifspamh [address]"
  exit 111
fi

message="`cat`"

# grab the file size
fsize=$(echo $message | wc -c)

if [ $fsize -gt 500000 ]; then
        # message is too large and we'd be better off not scanning it
  exit 0
fi

# we used to skip 'From ' - the 1st line that got added by spamd/spamc
# but it seems newer versions don't add it (and SA 2.50 adds a 3 line
# Received header)
output="`echo "$message" | $SPAMC | sed '1{/^From .*/d;}'`"
exitcode=$?

# spamc will not process a "large email"
#msize=`echo "$output" | wc -c`
# there's also a sizelimit with some shells that triggers around the
512kB mark
# with an external printf and arguments size so we stop at this point
#if [ $msize -gt 250000 ]; then
  # probably deemed too large anyway .. let it through
#       exit 0
#fi

I'd love to hear your thoughts on the matter...

Regards,

Wendell

Reply via email to