Hi Team
I am unable to view pdf and below is my logic for attaching pdf, please advice me i have been stuck with this issue for way to long. Advice me how to attach many docs after. When i try to open its said failed to load "Expected: application/pdf (.pdf); found: text/plain (.txt)"
PHP
" . $eol;
$headers .= "MIME-Version: 1.0" . $eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol;
$headers .= "Content-Transfer-Encoding: binary";
$headers .= "This is a MIME encoded message." ;
$headers .="Content-Length: . filesize($filenameee)";
$headers .="Accept-Ranges: bytes" ;
@readfile($filenameee);
$body .= "Monthly income: {$income}";
$body .= "";
$body .= "Town: {$town}";
$body .= "";
$body .= "Upload bankstatement {$bankstatement}";
$body .= "";
$body .= "Upload payslip: {$payslip}";
$body .= "";
$body .= " ";
// message
//$body = "--" . $separator . $eol;
$body .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
$body .= "Content-Transfer-Encoding: binary" . $eol;
$body .= $message . $eol;
// attachment
$body .= "--" . $separator . $eol;
$body .= "Content-Type: application/pdf; name=\"" . $filenameee . "\"" . $eol;
$body .= "Content-Transfer-Encoding: binary" . $eol;
$body .= 'Content-Disposition: inline; $filenameee="' . $filenameee . '"';
$body .= $content . $eol;
$body .= "";
$body .= "";
?>
Vishal JoshiRank #377 · 6.7K reputationPosted Mar 13, 2023, 1:10 AM EDT
Hello
Please try below code. You can create attachment array like
$attachement = array(); $attachement['data'][0] = 'pdfdata' // Pass PDF content with base64_encode $attachement['data'][1] = 'tpPdfdata'; $attachement['name'][0] = 'sample1.pdf'; $attachement['name'][1] = 'sample2.pdf'; enter code here 0) { for ($i = 0; $iThanks