Skip to content

Instantly share code, notes, and snippets.

@jsarenik
Created April 30, 2015 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 <xxxxxxxxx@ag.dmarcian.com>
X-Loop: jasan@jasan.tk
See attachment
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment