GPG question

I have recently setup GPG on my server and wrote a PHP script which encrypts some data using GPG and then emails me the results.

The problem is that the body of the email I receive is blank.

Could this be a permission problem and do I need to setup cgiwrap for use with PHP? Any suggestions would be greatly appreciated.

Following is the code that I use to do this:

//Set variables

//Directory containing the key ring
$gnupghome = "/var/www/vhosts/domainname.com/.gpg";
$gpg = "/usr/local/bin/gpg";
$recipient = "John Doe <jdoe@mail.com>";
$to = "jdoe@mail.com";
$subject = "Test";
$message = "This is a test";

//Set the environment variable for GNUPGHOME
putenv("GNUPGHOME=$gnupghome");

$command = "$gpg --armor -t --always-trust --batch --no-tty
";
$command .= "--compress-algo 1 --cipher-algo cast5 ";
$command .= "--recipient '$recipient' ";
$command .= "--encrypt ";
$command .= "| /bin/mail -s '$subject' $to";
$pp = popen($command, "w");
fputs($pp, $message);
pclose($pp);



Thanks,

David Delisle

 

 

 

 

Top