Skip to content

Instantly share code, notes, and snippets.

@kosztik kosztik/email-i.sh
Last active Dec 23, 2019

Embed
What would you like to do?
#!/bin/bash
#
# Use: email-i.sh /var/log/mail.info <from/to pattern>
# Used with postfix
if [[ $1 =~ gz ]]; then
cat="zcat"
else
cat="cat"
fi
id=`$cat $1| grep $2|grep -o "Queue-ID: *.........."|cut -d' ' -f2`
for i in $id
do
#cat /var/log/mail.info| grep $i| grep --color from| awk '{ print $0 }'
#cat /var/log/mail.info| grep $i| grep --color spam| awk '{ print $0 }'
$cat $1| grep $i| awk '{ print $0 }'
echo ========================================================================================
echo ========================================================================================
echo ========================================================================================
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.