Skip to content

Instantly share code, notes, and snippets.

@TauPan
Created January 11, 2016 10:55
Show Gist options
  • Save TauPan/8b8673bb9277cb744fa8 to your computer and use it in GitHub Desktop.
Save TauPan/8b8673bb9277cb744fa8 to your computer and use it in GitHub Desktop.
Displaying and replying to ms-tnef / winmail.dat attachments from #outlook in #mutt
application/ms-tnef; tnefsmime %s; copiousoutput
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Automatically use entries from ~/.mailcap to view these MIME types
#
# auto_view <type> [ <type> ... ]
auto_view application/x-gunzip application/x-gzip text/html application/ms-tnef
#!/usr/bin/env bash
filename=$(realpath -P $1)
dir=$(mktemp -d)
cd $dir
tnef $filename
for f in $(ls -1)
do
if [ "$f" = "smime.p7m" ]
then
gpgsm --decrypt $f
else
cat $f
fi
done
rm -rf $dir
@TauPan
Copy link
Author

TauPan commented Jan 11, 2016

@TauPan
Copy link
Author

TauPan commented Jan 12, 2016

I probably should mention the obvious: the script does no security checks whatsoever and makes some strong assumptions about my personal environment.

For example if somebody sneaks an alias for mktemp into your environment, rm -rf will delete all your files.

And I put my smime keys into gpgsm, obviously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment