====== PHP TEST =====
$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 "
";
echo $an."
";
echo $Subject."
";
echo $message."
";
echo $strFilesName."
";
echo $strContent."
";
echo $mail_header."
";
$flgSend = @mail($an,$Subject, $body, $mail_header);
if($flgSend)
{
echo "Mail send completed.";
}
else
{
echo "Cannot send mail.";
}
}
?>