# Sending GPG encrypted e-mails

**URL:** <https://www.ruby-forum.com/t/sending-gpg-encrypted-e-mails/106748>\
**Category:** Rails\
**Created:** [June 13, 2007, 8:03pm UTC](https://www.ruby-forum.com/t/sending-gpg-encrypted-e-mails/106748 "2007-06-13T20:03:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![redgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@redgar](https://www.ruby-forum.com/u/redgar)\
**Post date:** [June 13, 2007, 8:03pm UTC](https://www.ruby-forum.com/t/sending-gpg-encrypted-e-mails/106748/1 "2007-06-13T20:03:00Z")

</div>

Hi,

Has anyone has any success using GPG through ruby on rails?

WHAT I’VE TRIED:

I followed all the instructions from this tutorial:  
[http://www.ahgsoftware.com/articles/2007/03/18/how-to-encrypt-ruby-on-rails-mail-with-gnupg](http://www.ahgsoftware.com/articles/2007/03/18/how-to-encrypt-ruby-on-rails-mail-with-gnupg)

however, I am getting en ERROR I haven’t been able to resolve:

gpg: fatal: unable to reopen standard input, output, or error

QUESTION:

Would it be considered secure to write the captured form data into a  
file,  
then run an external exec command (a script which will accept the  
tmpfilename for encryption)  
to encrypt the file then delete the plaintext copy?

What would be the most secure way (this is for an online store) to  
encrypt a message with  
RECIPIENT key and send it off?

Is there a way to encrypt the e-mail body without having to write the  
plaintext to disk first?

Any help would be greatly appreciated.

\_\_  
Andy
