Skip to content

Instantly share code, notes, and snippets.

@jsarenik
Created April 30, 2015 09:34
Show Gist options
  • Save jsarenik/92105aa49937293015c6 to your computer and use it in GitHub Desktop.
Save jsarenik/92105aa49937293015c6 to your computer and use it in GitHub Desktop.
Forward mail with proper DKIM signature
#!/bin/sh
tmpfile=`mktemp /tmp/processmail.XXXXXXX.eml`
trap "rm -rf $tmpfile $tmpfile.dir" EXIT
cat > $tmpfile
mkdir $tmpfile.dir
ripmime -i $tmpfile -d $tmpfile.dir
TO=`grep "^To:" $tmpfile`
TO=${TO##* }
mailx -t \
-r "Jan Sarenik <$TO>" -a $tmpfile.dir/*.zip <<EOF
Subject: Report domain FWD
From: Jan Sarenik <$TO>
To: Dmarcian <[email protected]>
X-Loop: [email protected]
See attachment
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment