scripts/policyd-550.sh

12 lines
437 B
Bash
Executable file

#!/bin/bash
# Author: Oliver Ladner <oli@lugh.ch>
# License: LGPL
#
# Shows all mails rejected by policyd-weight.
# Requires that $REJECTMSG in /etc/policyd-weight.conf
# contains "550 Mail"
LOGFILE="/var/log/mail.log"
echo -e "Score\tRecipient\t\tSender"
grep -B1 '550 Mail' $LOGFILE | awk -F'<' '{print $4,$5}' | grep 'rate:' | sed -r -e 's/(to|from)=//g' -e 's/(>|;)//g' -e 's/rate: //g' | awk '{print $3"\t"$2"\t\t"$1}' | sort -n