Hello,
function verschickePdfMail($empfaenger, $betreff, $text, $pdfPfad, $pdf_dateinameMail){
$id = md5(uniqid(time()));
$dateiinhalt = file_get_contents($pdfPfad);
// Absender Name und E-Mail Adresse
//$kopf = "From: Manfred Mustermann meine@mailadresse.xy\n";
$kopf = "";
$body = "";
$kopf .= "MIME-Version: 1.0\n";
$kopf .= "Content-Type: multipart/mixed; boundary=$id\n\n";
$kopf .= "This is a multi-part message in MIME format\n";
$body .= "--$id\n";
$body .= "Content-Type: text/plain; charset=ISO-8859-15\n";
$body .= "Content-Transfer-Encoding: 8bit\n\n";
$body .= $text; // Inhalt der E-Mail (Body)
// Content-Type: image/gif, image/jpeg, image/png » MIME-Typen - selfHtml.org
$body .= "\n--$id";
$body .= "\nContent-Type: application/pdf; name=$pdf_dateinameMail\n";
$body .= "Content-Transfer-Encoding: base64\n";
$body .= "Content-Disposition: attachment; filename=$pdf_dateinameMail\n\n";
Schau mal nach, welches Zeilenende-Zeichen chunk_split() verwendet.
Wenn Du mittels sendmail-Script auf Linux versendest, solltest Du nur "\n" verwenden. MWn hat chunk_split aber "\r\n" als voreinstellung
$body .= chunk_split(base64_encode($dateiinhalt));
$body .= "\n--$id--";
return mail($empfaenger, $betreff, $body, $kopf); // E-Mail versenden
}
[/code]mfg. Daniel
Ein harzliches Glückauf
Tom vom Berg