aloha...! long no see.
i have some weird problems attaching dynamically generated pdf documents to an email. most people who receive the mail cannot open the attached pdf, though it is shown as one. there must be something wrong with the encoding i think, but i didnt find a solution. its weird, because if i send the mail to my adress, it works perfectly (tested with firefox as mail-client).... but not on my clients' accounts, the other way around would be better 😉 i am using fpdf to generate the pdfs.
i suppose the mistake to be on this line
$header.= "Content-Type: application/pdf; name=\"".$attach[$i].".pdf\"\n\n";
i tried 'application/octetstream' too instead of 'application/pdf'. no success so far. can anyone out there help me?
# attachments
for ($i=0; $i<count($attach); $i++) {
# add new part to email for each attachment
$header.= "--$boundary1\n";
# attachment öffnen
$file[$i] = fopen($angebotsdir.$attach[$i].".pdf", 'rb');
# attachment einlesen
$data[$i] = fread($file[$i], filesize($angebotsdir.$attach[$i].".pdf"));
# Dateihandle schliessen
fclose($file[$i]);
$header.= "Content-Transfer-Encoding: base64\n";
$header.= "Content-Type: application/pdf; name=\"".$attach[$i].".pdf\"\n\n";
$header.= "Content-Disposition: attachment; filename=\"".$attach[$i].".pdf\"\n\n";
$header.= chunk_split(base64_encode($data[$i]));
}
thank you.