View Full Version : GNUPG e-mail encryption

03-30-2007, 06:10 AM

I made this script to encrypt a message and send it by mail but it does not work:

//build the message string
$msg = "Sender's Full Name:\t". $_POST["sender_name"] ."\n";
$msg .= "Sender's E-Mail:\t". $_POST["sender_email"] ."\n";
$msg .= "Secret Message?\t". $_POST["secret_msg"] ."\n\n";

//set the message vars
$gnupghome = "/home/httpd/vhosts/domain.com/httpdocs/.gnupg";
$uid = "Name (Nic) <recipient@domain.com>";
$to = "recipient@isp.com";
$subject = "Secret Message";
$mailheaders = "From: ". $_POST["sender_email"];

//Encript the message
$cmd = "echo '$msg' | /usr/bin/gpg --textmode --always-trust ";
$cmd .= "--armor --batch --no-secmem-warning --homedir '$gnupghome' ";
$cmd .= "--compress-algo 1 --cipher-algo cast5 --recipient '$uid' --encrypt";
$encrypted = `$cmd`;

//Send encripted mail
mail($to, $subject, $encrypted, $mailheaders);


Please help me to solve my doubts:

1.Can “.gnupg" directory be moved to any place?
2.What do “`” at “`$cmd`” mean?
3.What am I missing?


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum