Вот небольшой сценарий, который я написал. Сохраните его в ~/username/bin/gpgmail и запустите chmod 755 gpgmail
. Запустите с помощью gpgmail
.
#!/bin/bash
# Send encrypted email
# Requires gpg and mail to be setup
echo "Available keys:"
gpg --list-keys
# Gather variables
echo "Enter public key of recipient:"
read user
echo "Enter email:"
read email
echo "Enter subject:"
read subject
echo "Enter message:"
read message
# Pipe the echoed message to gpg, sign and encrypt it to ascii (-eas), include your key so you can read it,
# include recipients key, pipe to mail with the (unencrypted) subject, send to the given email.
echo "$message" | gpg2 --no-emit-version -eas -r galenasphaug@gmail.com -r $user | mail -s "$subject" $email