Read quarantined spam in mail client?

John Goggan jgoggan at DCG.COM
Tue Mar 18 00:23:01 GMT 2003


If anyone is interested, I modified Julian's df2mbox to instead handle the
combined ("h-file") format and create valid mbox files.  Like df2mbox, you can
give it multiple directories in the quarantine and it will go through, process
each one, and give you a "spam.<directory>" file in mbox format.  Here it is:

---
#!/bin/sh
#
# JKF 27/06/2002 (C) Julian Field
#
# This script will create an "mbox" format file called "spam.<dirname>"
# in the current directory for each of the directories which are passed
# on the command-line to this script. So you can do
#    cd /var/spool/MailScanner/quarantine
#    h2mbox *
# and it will create a "spam.<dirname>" file in the current directory,
# where each <dirname> is one of the directory names passed on the
# command line. This file will contain all the messages that were
# quarantined in their entirety.
# So if you have
#    Quarantine Whole Message = no
# the only thing in these directories will be spam, not viruses (but
# it will include spam that contained viruses, so be careful!).
#
# Note that h2mbox is for use when you have
#    Quarantine Whole Messages As Queue Files = no
# set.  If you have that set to yes, then you need df2mbox instead.
#
# Version 1.1 (df2mbox) Include date format fix
# Version 1.2 (df2mbox) Supports directory layout in MailScanner V4
# Version 1.3 h2mbox based on df2mbox; modified by jgoggan at dcg.com for
#             use with the new "header then body in 1 file" format.
#

parentdir=`pwd`
export parentdir

while [ -n "$1" ]
do
  dir="$1"
  shift

  echo -n "Processing directory $dir..."
  if [ \! -d $dir ]; then
    echo $dir is not a directory
    exit 1
  fi

  cd $dir/spam

  for h in h*
  do
    from=`grep 'From:' $h | sed 's/.*\(<.*>\)/\1/g'`
    echo From $from `date "+%a %b %d %T %Y"`
    cat $h
    echo
  done > mbox.$dir

  cd $parentdir
  mv $dir/spam/mbox.$dir spam.$dir
  echo
done
---

 - John...



More information about the MailScanner mailing list