rp

simple email tools
git clone https://git.parazyd.org/rp
Log | Files | Refs | README | LICENSE

commit cd15200842b4a57348b9c4d43a45c49a313869f1
parent 4794fef4cfcb68a8298a34ed616043f13584b2de
Author: parazyd <parazyd@dyne.org>
Date:   Thu,  1 Mar 2018 11:46:06 +0100

Add rpgpgenc.

Diffstat:
Abin/rpgpgenc | 44++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+), 0 deletions(-)

diff --git a/bin/rpgpgenc b/bin/rpgpgenc @@ -0,0 +1,44 @@ +#!/bin/sh + +boundary="FuNkAdEliC" +_cd="Content-Disposition: inline" + +email="$(cat)" + +if [ $# -gt 0 ]; then + to="-r $1" +else + to="$(echo "$email" | rpheaders To)" + to="-r $to" +fi + +headers="$(printf "$email" | sed '/^$/q' | sed "s/Content-Type.*/$_cd/")" +emabody="$(printf "$email" | sed '1,/^$/d' )" # | sed 's/ $/=20/')" + +encr="$(cat <<EOM | sed 's/$/\r/' | gpg -eaq $to)" + +$emabody +EOM + + +cat <<EOF | sed 's/$/\r/' +$headers +Content-Type: multipart/encrypted; boundary="$boundary"; + protocol="application/pgp-encrypted" +Content-Disposition: inline + + +--$boundary +Content-Type: application/pgp-encrypted +Content-Disposition: attachment + +Version: 1 + +--$boundary +Content-Type: application/octet-stream +Content-Disposition: attachment; filename="msg.asc" + +$encr + +--$boundary +EOF