Hi,
I have a _very_ small script on filtering mails with file attachment.
This will work only on single attachment. However, you can extend
this script to filter multiple attachments
As I have said this is a quick and dirty way to filter attachments.
I'm not a good hack, you can write your own script much much
better than this.
I wrote this because I've been searching the qmail archive and I couldn't
find a single _example_ script for this subject. This posting is directed
to qmail beginners like me. I hope this will be kept in the archive for
future reference.
Thanks,
Noel Mistula
==========================================
#!/bin/bash
#
# qmail -- checkattach
# Author: Noel G. Mistula
# Date: 28 June 1999
#
# This is release under the GNU/GPL.
# This is a very crude program. Use at your own risk.
# This will delete incoming email with executable,
# video and other attachments.
# Just comment/uncomment/add whichever is required.
#
# I use this in a user's .qmail file
# by adding the line
# |/usr/local/bin/checkattach
# before the ./Maildir/
#
# Save this script in /usr/local/bin as checkattach
#
# Check for executable, application and other attachment.
ATTACHTYPE=`grep "Content-Description:" - | gawk {'print $3'} | cut -c 2-`
if [ $ATTACHTYPE != "" ]; then
case $ATTACHTYPE in
Application)
exit 100;;
MS-DOS)
exit 100;;
Video)
exit 100;;
Movie)
exit 100;;
RealAudio)
exit 100;;
Bitmap)
exit 100;;
MP3)
exit 100;;
Wave)
exit 100;;
*)
exit 0;;
esac
fi
exit 0
=============================================