PX : code

PDF Form Submission CGI by James Morris
Download this code


<html>
    <?php
    $to 
"ToEmail";
    
$from "FromEmail";
    
$subject "EmailSubject";
    
$body "EmailBody";
    
$attachment_name "FileName";
    
$attachment_type "application/octet-stream";
    if(
$HTTP_RAW_POST_DATA){
            
$data chunk_split(base64_encode($HTTP_RAW_POST_DATA));
        
$headers "From: $from\r\n";
        
$boundary "=====NextSection." md5(uniqid(time())) . "=====";
        
$headers .= "MIME-Version:1.0\r\n";
        
$headers .= "Content-Type: multipart/mixed; \r\n\tboundary=\"$boundary\"\r\n\r\n";
        
$str "--" $boundary "\r\n";
        
$str .= "Content-Type: text/plain;\r\n\tcharset=\"us-ascii\"\r\n";
        
$str .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
        
$str .= "$body\r\n\r\n";
        
$str .= "--" $boundary "\r\n";
        
$str .= "Content-Type: " $attachment_type ";\r\n\tname=\"" $attachment_name "\"\r\n";
        
$str .= "Content-Transfer-Encoding: base64\r\n";
        
$str .= "Content-Disposition: attachment; \r\n\tfilename=\"" $attachment_name "\"\r\n\r\n";
        
$str .= $data "\r\n";
        
$str .= "\r\n--$boundary--\r\n";
        
$body $str;
        
mail($to$subject$body$headers);
        }
    
?>
    <body>
    </body>
</html>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.