Using the following code;

                $fileRead = fopen($fileAtt,'rb'); 
                $fileData = fread($fileRead,filesize($fileAtt)); 
                fclose($fileRead); 
                
                $mimeBoundary = "CCALCBoundary"; 
                
                $headers = "From: ".$emailFrom."\n"; 
                $headers .= "MIME-Version: 1.0\n";
                $headers .= "Content-Type: multipart/mixed;\n";
                $headers .= " boundary=\"$mimeBoundary\""; 
                
                $emailMessage = "This is a multi-part message in MIME
format.\n\n";
                $emailMessage .= "--$mimeBoundary\n";
                $emailMessage .= "Content-Type:text/plain;
charset=\"iso-8859-1\"\n";
                $emailMessage .= "Content-Transfer-Encoding: 7bit\n\n";
                $emailMessage .= $emailText."\n\n"; 
                
                $fileData = chunk_split(base64_encode($fileData)); 
                
                $emailMessage .= "--$mimeBoundary\n"; 
                $emailMessage .= "Content-Type: $fileAttType;\n";
                $emailMessage .= " name=\"$fileAttName\"\n";
                $emailMessage .= "Content-Disposition: attachment;\n";
                $emailMessage .= " filename=\"$fileAttName\"\n";
                $emailMessage .= "Content-Transfer-Encoding: base64\n\n"
. $fileData . "\n\n" . "--$mimeBoundary--\n"; 
                
                $message = $emailMessage;
                $ok = @mail($emailTo, $emailSubject, $message,
$headers); 

I am reading in a PDF file to attach to an e-mail being sent to sales
agents. When they receive the e-mail the PDF file is attached, but
unreadable (error 114, cannot be read) and the PDF is blank. This is a
new error and as this same process worked last month. Can anyone shed
some light on this for me? Thanks!

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

Reply via email to