Ось невеликий сценарій, який я написав. Збережіть його у ~ / 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