How can I send gpg encrypted mail automatically from the linux command line?

I'm a little stumped on this one, I've tried using mutt but it doesn't encrypt mail unless it's used interactively.

Does anyone know if you can use the build in mail command to do this some how?

link|improve this question

feedback

1 Answer

up vote 3 down vote accepted

try something like

gpg -ea -r "Recipient name" -o - filename | mail -s "Subject line" recipient@example.com

to send an ascii-armored, public-key-encrypted copy of the file "filename" to a person named "Recipient name" (who is in your gpg keyring) at email address recipient@example.com with the specified subject line.

or

echo "Your secret message" | gpg -ea -r "Recipient name" | mail -s "Subject" recipient@example.com

to send text directly rather than from a cleartext file on disk.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.