--- /dev/null
+#!/bin/sh
+# stats about gif file rejects via postfix pcre body_checks
+# sven@timegate.de
+
+MAILLOG="/var/log/mail.log"
+RJL="/tmp/gifrejects.$$"
+
+grep "reject: body R0lGOD" $MAILLOG > $RJL
+
+printf "\n"
+echo "Mail rejects with gif file statistics for host $(hostname)"
+echo "=========================================================="
+echo "Generated on $(date)"
+printf "\n"
+echo "Mail log starts on: $(head -n 1 $MAILLOG|awk '{print $1" "$2" "$3}')"
+echo "First reject on: $(head -n 1 $RJL|awk '{print $1" "$2" "$3}')"
+echo "Last reject on: $(tail -n 1 $RJL|awk '{print $1" "$2" "$3}')"
+echo "Mail log ends on: $(tail -n 1 $MAILLOG|awk '{print $1" "$2" "$3}')"
+echo "We have $(wc -l $RJL|awk '{print $1}') rejects in total in the logfile."
+printf "\n"
+
+echo "Rejects sorted by number and sender address"
+awk '{print $12}' $RJL|grep from|sed -e 's/from=//g'|sort|uniq -c|sort -rn
+printf "\n"
+
+echo "Rejects sorted by number and destination address"
+awk '{print $13}' $RJL|grep to|sed -e 's/to=//g'|sort|uniq -c|sort -nr
+printf "\n"
+
+echo "Rejects sorted by number and sender-destination address combinations"
+awk '{print $12" "$13}' $RJL|grep '^from'|sed -e 's/from=//g' -e 's/to=//g'|sort|uniq -c|sort -nr|awk '{print "\t"$1"\tFrom: "$2" To: "$3}'
+
+# CLEAN UP
+rm $RJL
\ No newline at end of file