in current project, have create pdf file on fly , attach mail attachment , send. works fine, file generate , send email provided. when send microsoft outlook or windows live account, pdf has attached can't open file pdf, gives , error saying, damaged. gmail , yahoo works fine. have solution this. below code $dompdf = new dompdf(); $dompdf->load_html($message); $dompdf->set_paper("a4", "landscape"); $dompdf->render(); // next call store entire pdf string in $pdf $pdf = $dompdf->output(); // can write $pdf disk, store in database or stream client. file_put_contents("pdfs/invoice.pdf", $pdf); $fileatt = "pdfs/invoice.pdf"; // path file $fileatt_type = "pdf"; // file type $fileatt_name = "invoice.pdf"; // filename used file attachment $fp = fopen($fileatt, "rb"); $file = fread($fp, filesize($fileatt)); $file = chunk_split(base64_encode($file...