HTML:
<?php
#bisher $an
$empfaenger = "[email protected]"; // Empfänger E-Mail Adresse
$betreff = "E-Mail zum Test mit Anhang"; // Betreff
$dateiname = "anhang1.pdf"; // Dateiname auf dem server im ordner
$dateiname_mail = "test1.pdf";//dateiname bei dem empfänger
$dateiname2 = "anhang2.pdf"; // Dateiname auf dem server im ordner
$dateiname_mail2 = "test2.pdf";//dateiname bei dem empfänger
$dateiname3 = "anhang3.pdf"; // Dateiname auf dem server im ordner
$dateiname_mail3 = "test3.pdf";//dateiname bei dem empfänger
$id = md5(uniqid(time()));
$dateiinhalt = fread(fopen($dateiname, "r"), filesize($dateiname));
$dateiinhalt2 = fread(fopen($dateiname2, "r"), filesize($dateiname2));
$dateiinhalt3 = fread(fopen($dateiname3, "r"), filesize($dateiname3));
// Absender Name und E-Mail Adresse
$kopf = "From: <[email protected]>\n";
$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";
$kopf .= "--$id\n";
$kopf .= "Content-Type: text/plain\n";
$kopf .= "Content-Transfer-Encoding: 8bit\n\n";
$kopf .= "E-Mail mit Anhang"; // Inhalt der E-Mail (Body)
$kopf .= "\n--$id";
// Content-Type: image/gif, image/jpeg, image/png
$kopf .= "\nContent-Type: application/pdf; name=$dateiname_mail\n";
$kopf .= "Content-Transfer-Encoding: base64\n";
$kopf .= "Content-Disposition: attachment; filename=$dateiname_mail\n\n";
$kopf .= chunk_split(base64_encode($dateiinhalt));
$kopf .= "\n--$id";
// Content-Type: image/gif, image/jpeg, image/png
$kopf .= "\nContent-Type: application/pdf; name=$dateiname_mail2\n";
$kopf .= "Content-Transfer-Encoding: base64\n";
$kopf .= "Content-Disposition: attachment; filename=$dateiname_mail2\n\n";
$kopf .= chunk_split(base64_encode($dateiinhalt2));
$kopf .= "\n--$id--";
// Content-Type: image/gif, image/jpeg, image/png
$kopf .= "\nContent-Type: application/pdf; name=$dateiname_mail3\n";
$kopf .= "Content-Transfer-Encoding: base64\n";
$kopf .= "Content-Disposition: attachment; filename=$dateiname_mail3\n\n";
$kopf .= chunk_split(base64_encode($dateiinhalt3));
$kopf .= "\n--$id--";
mail($empfaenger, $betreff, "", $kopf); // E-Mail versenden
echo "fertig";
?>
Hallo,
aber einen Codeschnipsel mit dem ich testweise eine Mail mit Anhang versenden kann.
Der vorliegende Code klappt aber nur bei zwei Mail.
Mit drei habe ich es nicht hingebracht ... Fehlermeldung kommt keine.
Sieht jemand woran das liegen könnte?