|
Posted by "zedleon" on 01/09/06 21:34
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>";
?>
Navigation:
[Reply to this message]
|