the code below encrypts a phrase using gpg and sends out via email ...
i get the data ok ... but my mail client does not show it ... if i "view
email sorce"  i can see the encrypted message ... what am i doing wrong?

thanks,
jd


    $username = "mohadib"; 
        $pgp="/usr/bin/gpg"; 
        $user="Zend Commerce <[EMAIL PROTECTED]>"; 
        $recp="[EMAIL PROTECTED]"; 
        //$data=$oneOrder; 
        $command = 'echo "hello word" | '.$pgp.' -a --always-trust
--batch --no-secmem-warning -e -u "'.$user.'" -r "'.$recp.'"'; 
        $oldhome = getEnv("HOME"); 
        putenv("HOME=/home/$username"); 
        $result = exec($command, $encrypted, $errorcode); 
        putenv("HOME=$oldhome"); 

        $subject="Test message"; 

        $headers  = "MIME-Version: 1.0\r\n"; 
        $headers .= "Content-Type: multipart/encrypted;
protocol=\"application/pgp-encrypted\";
boundary=\"=-uc4rTrDFZtVQGtcexwyv\"\r\n"; 

        $message = "--=-uc4rTrDFZtVQGtcexwyv 
Content-Type: application/pgp-encrypted 
Content-Transfer-Encoding: 7bit 

Version: 1 

--=-uc4rTrDFZtVQGtcexwyv 
Content-Type: application/octet-stream; name=encrypted.asc 
Content-Transfer-Encoding: 7bit\n\n"; 

        $message .= implode("\n", $encrypted); 
        $message .= "\n\n--=-uc4rTrDFZtVQGtcexwyv--"; 
        mail($recp,$subject,$message,$headers);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to