php piping to a program ( get the vars) convert back to an email fomat with no headers etc

StackOverflow https://stackoverflow.com/questions/9116923

  •  21-04-2021
  •  | 
  •  

Question

I can pipe to a program but how do I convert the email so the code can be emailed and read by email clients? I can email it but its full of other chars. How can i get it without all the extra messy code showing up on page. I just want the email in its old format that can be read in an email. I need this to read both html and tex.

 #!/usr/bin/php –q
<? 
     $fd = fopen("php://stdin", "r"); 
    while (!feof($fd)) {
     $email .= fread($fd, 1024); }


    $to = "someone@example.com";

    $subject = "Test mail";

    $message = $email;

    $from = "someonelse@example.com";

    $headers = "From:" . $from;

    mail($to,$subject,$message,$headers); ?>

No correct solution

OTHER TIPS

Those are just e-mail headers, some of them added by the esmtp-server or any other servers in between. Is does not have to do with messy code, it's the misinterpretation of the headers by the client.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top