Hello!
I am using FPDF (http://www.fpdf.org) to generate pdf files on the fly. I am then taking that generated content and attaching it in an email and sending it off.
I have tested it with my gmail account, and the file has the correct file name and I am able to open it successfully. However when I send it to an email address at my work (which is on an exchange server), I am unable to open the file.
Has anyone ever seen this happen on a Exchange server before? Thank you for your help! Please find an example of the code I am using below.
-Jason
$attachment = $pdf->Output("PO 305-4354.pdf","S");
$attachment = chunk_split(base64_encode($attachment));
$uid = md5(uniqid(time()));
$header = "From: ".$from."\r\n";
$header .= "Reply-To: ".$from."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/html; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/pdf; name=\"PO 305-4354.pdf\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"PO 305-4354.pdf\"\r\n\r\n";
$header .= $attachment."\r\n\r\n";
$header .= "--".$uid."--";
mail($to, $subject, "", $header);