Message body is empty in email

David Delisle david@webbloom.com
Thu Feb 28 03:14:01 2002


I am trying to encrypt form data and then email this data to myself.

 The email is sent correctly, but the body of the email message is
completely empty. Any help would be greatly appreciated. I believe that gpg
is not actually being run. I have given all permissions to gpg and changed
the ownership from root so that any web users can access the file. Following
is my code (I am using PHP as the programming language):

                //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);

 Thank you,

 David Delisle