<?php
if (isset ($ _ POST ['anfrage'])) {функция умерла ($ error) {echo "Ihre Nachricht könnte nicht gesendet werden, bitte versuchen s ie später nochmal"; д ie (); }
$body = "<br><br><br><div style='font-style: Georgia; border-style: dotted solid double;'>";
$body .= " <h2 style='text-align: center;'>Project</h2><br><h3> Persönliche Daten</h3>";
$body .= "</div>";
#####################################################################
/* GET File Variables */
$eol = PHP_EOL;
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_$semi_rand";
$message = "--$mime_boundary$eol" . "Content-Type: text/html; charset=\"charset=utf-8\"$eol" . "Content-Transfer-Encoding: 7bit$eol$eol$body$eol";
for ($i = 0; $i < count($_FILES['attachment']['name']); $i++) {
$tmpName[] = $_FILES['attachment']['tmp_name'][$i];
$fileType[] = $_FILES['attachment']['type'][$i];
$fileName[] = $_FILES['attachment']['name'][$i];
$img = "";
$me = "";
$img .= chunk_split(base64_encode(file_get_contents($tmpName[$i])));
$message .= "--$mime_boundary$eol" . "Content-Type: $fileType[$i];$eol name=\"$fileName[$i]\"$eol" . "Content-Disposition: attachment;$eol filename=\"$fileName[$i]\"$eol" . "Content-Transfer-Encoding: base64$eol$eol$img$eol";
}
// print_r($message); die();
#####################################################################
$email_to = "email@email.com";
$empfaenger = "$email_to";
$absender = "$kundenemail";
$betreff = "Project-anfrage von $name";
$antwortan = "$kundenemail";
$header = "From: $kundenemail$eolMIME$eol" . "Content-Type: multipart/mixed;$eol boundary=\"$mime_boundary\"";
// $header = "MIME-Version: 1.0\r\n";
// $header .= "Content-type: text/html; charset=utf-8\r\n";
$header .= "From: $absender\r\n";
$header .= "Reply-To: $antwortan\r\n";
// $message .= "--$mime_boundary$eol";
// $header .= "Cc: $cc\r\n"; // falls an CC gesendet werden soll
$header .= "X-Mailer: PHP " . phpversion();
mail($empfaenger, $betreff, $message, $header);
header("Location: index.php");
}?>