Skip to content

Instantly share code, notes, and snippets.

@tasoseng
Created March 27, 2021 22:06
Show Gist options
  • Save tasoseng/849e97cea58bb3c831730980b87f35c1 to your computer and use it in GitHub Desktop.
Save tasoseng/849e97cea58bb3c831730980b87f35c1 to your computer and use it in GitHub Desktop.
find all mails a user has received, $1 = To: email (sendmail)
#!/bin/sh
set -eu
export IFS='
'
TO=$1
for ID in $(grep to=\<"$1"\> /var/log/everything | awk '{print $6}'| tr -d : ); do
FROM=$(grep "$ID" /var/log/everything | grep from= | cut -f2 -d\<|cut -f1 -d\>)
echo $FROM '->' $TO
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment