sending email with pgp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kelly

    sending email with pgp

    Can anyone see why this wouldn't work? I get the mail but it is always blank. The key
    is installed on the server properly (so I am told). Basically the encrypting of the message
    seems to be the only thing that doesn't work. I have stepped through it many times and
    the message is fine until it gets encrypted then it becomes blank. I should at least be able
    to echo it to the screen or get it in the mail and see it encrypted but I can't.


    TIA,
    Kelly

    $message2 is the content of the email just text

    $message2 = "Foo";

    $subject = "This is my subject";
    $headers2 = "";
    $headers2 .= "MIME-Version: 1.0\r\n";
    $headers2 .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers2 .= "From: " . $sender_name . " <" . $admin_email . ">\r\n";
    $headers2 .= "To: " . $sender_name . " <" . $admin_email . ">\r\n";
    $headers2 .= "Reply-To: " . $name . " <" . $email . ">\r\n";

    $gpg = 'correct path to gnupg ';
    $recipient = "email for pub key";

    $encrypted_mess age = base64_encode(s hell_exec("echo $message2 | $gpg -e -r $recipient"));
    mail("", $subject, $encrypted_mess age, $headers2);

  • Daniel Tryba

    #2
    Re: sending email with pgp

    Kelly <foo@foo.com> wrote:[color=blue]
    > [-- text/plain, encoding quoted-printable, 34 lines --][/color]

    PLEASE don't post html.
    [color=blue]
    > Can anyone see why this wouldn't work? I get the mail but it is always
    > blank. The key is installed on the server properly (so I am told).
    > Basically the encrypting of the message seems to be the only thing
    > that doesn't work. I have stepped through it many times and the
    > message is fine until it gets encrypted then it becomes blank. I
    > should at least be able to echo it to the screen or get it in the mail
    > and see it encrypted but I can't.[/color]

    Code is good, encryption returns blank... guess where the problem is :)
    [color=blue]
    > $encrypted_mess age = base64_encode(s hell_exec("echo $message2 | $gpg
    > -e -r $recipient"));[/color]

    If I use gpg this way with a random key... gpg will complain about:
    "It is NOT certain that the key belongs to the person named
    in the user ID. If you *really* know what you are doing,
    you may answer the next question with yes

    Use this key anyway?"

    So is the key you are signing trusted?

    If you don't care about the trust model: --always-trust

    --

    Daniel Tryba

    Comment

    Working...