Help getting PHP and GPG to work

From: Date: Mon, 09 Jan 2006 19:34:55 +0000
Subject: Help getting PHP and GPG to work
Groups: php.general 
Request: Send a blank email to php-general+get-228359@lists.php.net to get a copy of this message
Has anybody had success using PHP and GPG to send encripted email from a form? Seems like people avoid this issue like the plague. Very little is written about it. I am trying to get a script to work that was written in the book "php essentials" by Julie Meloni. Am I barking up the wrong tree? Any success stories? "Anything" would be helpful I can make it work half way, then run into the dreaded permission issues. Some opinions or suggestions on what to do would be appreciated. Here is the code I have presently. <? $time = time(); $msg = "Sender's Full Name:\t$sender_name\n"; $msg .= "Sender's E-Mail:\t$sender_email\n"; $msg .= "Secret Message?\t$secret_msg\n\n"; putenv("GNUPGHOME=/home/path/.gnupg"); $clear = "/home/path/temp/input/data"; $clear .= "$time"; $crypted = "/home/path/temp/output/data"; $crypted .= "$time"; $fp = fopen("$clear", "w+"); fputs($fp, $msg); fclose($fp); system("/usr/bin/gpg -r my name <myemail@address.com>' -o $crypted -a $clear"); unlink("$clear"); $fd = fopen($crypted, "r"); $mail_cont = fread($fd, filesize($crypted)); fclose($fd); unlink("$crypted"); $recipient = "myemail@address.com"; $subject = "GnuPG Test"; $mailheaders = "From: www.mywebsite.com <\"\">\n"; $mailheaders .= "Reply-To: $sender_email\n\n"; mail("$recipient", "$subject", $mail_cont, $mailheaders); echo "<H1 align=center>Thank You, $sender_name</h1>"; echo "<p align=center>Your message has been sent.</p>"; ?>

« previous php.general (#228359) next »