Shell script to display recipient email from message id - postfix
#!/bin/bash<br></br>
if [ -z "$1" ];then<br></br>
echo "Usage:$0 <message id="">"<br></br>
else<br></br>
abuse=`echo $1| cut -f2 -d.`<br></br>
log_seq=0<br></br>
if [ "$log_seq" -le 1 ];then<br></br>
log_file=/var/log/maillog<br></br>
else<br></br>
log_file=/var/log/maillog/$log_seq<br></br>
fi<br></br>
cat $log_file | grep $abuse | grep -w relay | awk '{print $7}' | sed 's/.*.*/\1/'<br></br>
fi</message>```