X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=gpg-mailkeys%2Fgpg-mailkeys;h=7abe2200ee4dcd54811ad2a14d8e1ddd9eacaaad;hb=6356071d290e22e2e4a379bd474c4b3a5dbc0e3e;hp=cacaf1dfac3637ac23b29c69ce1f8341d085e063;hpb=5d3f53d44172671c3b76b5e3663b2dc62f6ae3fb;p=pgp-tools.git diff --git a/gpg-mailkeys/gpg-mailkeys b/gpg-mailkeys/gpg-mailkeys index cacaf1d..7abe220 100755 --- a/gpg-mailkeys/gpg-mailkeys +++ b/gpg-mailkeys/gpg-mailkeys @@ -8,6 +8,33 @@ set -e VERSION='$Rev$' +# Define the charset used in the text message of the mail +LOCAL_CHARSET="" + +## +# Get the local charset. +# +# The local charset is deduced from the charset used by both ~/.gpg-mailkeysrc +# and ~/.signature. If none of these files exist, the local charset is assumed +# to be us-ascii. + +get_local_charset () +{ + local charset="us-ascii" + local file_list="$HOME/.signature $HOME/.gpg-mailkeysrc" + + for filename in $file_list; do + + if [ -e $filename ]; then + charset=`file --mime-encoding $filename | cut -d ' ' -f 2` + break + fi + + done; + + LOCAL_CHARSET=$charset +} + if [ -z "$*" ]; then printf "Send people their newly signed GPG key by mail.\n" printf "Usage: $0 keyid ...\n" @@ -34,6 +61,11 @@ Here is your signed GPG key. Enjoy, $NAME" fi +if [ -z "$SENDMAIL_ARGS" ]; then + SENDMAIL_ARGS="" +fi + +get_local_charset FAILKEYS= @@ -66,18 +98,18 @@ Content-Disposition: inline --$BOUNDARY -Content-Type: text/plain; charset=us-ascii +Content-Type: text/plain; charset=$LOCAL_CHARSET Content-Disposition: inline Content-Transfer-Encoding: quoted-printable -$TEXT +`echo "$TEXT" | qprint -e` EOM if [ -f ~/.signature ]; then printf -- "--=20\n" >> $TEMPFILE - cat ~/.signature >> $TEMPFILE + qprint -e ~/.signature >> $TEMPFILE fi cat << EOM >> $TEMPFILE @@ -91,7 +123,7 @@ Content-Disposition: attachment; filename="$1.asc" --$BOUNDARY-- EOM printf " sending" - /usr/sbin/sendmail -ti <$TEMPFILE + /usr/sbin/sendmail $SENDMAIL_ARGS -ti <$TEMPFILE rm $TEMPFILE printf " done.\n" shift 1