PHP TEST
<php> $valuetext = „“; if (isset($_POST[„submit“]))
{ echo "Versenden vorbereiten!"; $eol = "\r\n"; $separator = md5(time()); $valuetext = " disabled "; $name = $_POST['name']; $an = $_POST['mailaddress']; //$file = $_POST['fileauswahl']; //$FileName="kein"; //if ($file==1) $FileName = "file1.txt"; //if ($file==2) $FileName = "file2.txt";
//if ($FileName=="kein") $EmailSenden = 0; else $EmailSenden = 1; $Subject = "FileName";
$mail_header = 'From:' . $name . "\n"; $mail_header .= "MIME-Version: 1.0".$eol; $mail_header .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol; $mail_header .= "Content-Transfer-Encoding: 7bit".$eol; $mail_header .= "This is a MIME encoded message." . $eol; // message $body = "--" . $separator . $eol; $body .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol; $body .= "Content-Transfer-Encoding: 8bit" . $eol;
if($_FILES["attachment"]["name"] != "") { $strFilesName = $_FILES["attachment"]["name"]; $strContent = file_get_contents($_FILES["attachment"]["tmp_name"]); $strContent = chunk_split(base64_encode($strContent)); $body .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"".$eol; $body .= "Content-Transfer-Encoding: base64".$eol; //$body .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"".$eol; $body .= "Content-Disposition: attachment".$eol; $body .= $strContent.$eol; $body .= "--" . $separator . "--"; }
// Verschicken der Mail echo "<br />"; echo $an."<br />"; echo $Subject."<br />"; echo $message."<br />"; echo $strFilesName."<br />"; echo $strContent."<br />"; echo $mail_header."<br />"; $flgSend = @mail($an,$Subject, $body, $mail_header); if($flgSend) { echo "Mail send completed."; } else { echo "Cannot send mail."; } }
?> </php> <html> <form id=„contact_form“ action=„“ method=„post“ enctype=„multipart/form-data“ name=„contact_form“ class=„col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3“> <input id=„name“ type=„text“ name=„name“ value=„“ placeholder=„Name“/><br /><br /> <input id=„company“ type=„text“ name=„mailaddress“ value=„“ placeholder=„E-Mail“ /><br /><br /> <input id=„attachment“ type=„file“ name=„attachment“ placeholder=„Datei (max. 10 MB)“ size=„45“ /><br /><br />
<input id=„submit“ type=„submit“ name=„submit“ value=„VERSENDEN“/><br /><br /> </form>
</html>