Archive for 4th March 2011

sendenc – Send an encrypted email from the shell.

This script requires that you have a mail server configured on the machine your running it from.
# Date: 03-18-2010
# Created by Dave Crouse

# Filename: sendencrypted
# Usage: sendencrypted
# Notes: Interactive- send passphrase encrypted email.

echo "Send Passphrase Encrypted Email."
echo "------------------------------------------------"
read -p " Enter your email address: " replyto
read -p " Enter the email address you are sending to: " name
read -p " Enter the subject line of your email: " subject
echo "Enter the name/comment to put on the encrypted message. \
Just hit enter if you don't want any comments on it."
read -p "Note, this will be in clear text and readable by anyone! : " comment;
read -p "Hit ENTER to open vi and create your email." temp;

vi passphraseencryption
gpg --armor --comment "$comment" --no-options --output \
passphraseencryption.gpg --symmetric passphraseencryption
shred -u passphraseencryption

emailthis=`cat passphraseencryption.gpg`

cat <<EOF | /usr/sbin/sendmail -f noreply -t
subject: ENCRYPTED-${subject}
content-type: text/plain

shred -u passphraseencryption.gpg
exit 0