您好我尝试通过php邮件将表单发送到我的邮件
我正在使用mail.php文件发送包含以下代码的邮件:
<?php
$mailTo = 'my@mail.com';
$mailFrom = '"request" <sender@mail.com>';
$mailSubject = 'Neue Anfrage';
$returnPage = 'http://mywebsite.com/thank-you.html';
$returnErrorPage = 'http://mywebsite.com//error.html';
$mailText = "";
if(isset($_POST)) {
foreach($_POST as $name => $value) {
if(is_array($value)) {
$mailText .= $name . ":\n";
foreach($valueArray as $entry) {
$mailText .= " " . $value . "\n";
}
}
else {
$mailText .= $name . ": " . $value . "\n";
}
}
}
if(get_magic_quotes_gpc()) {
$mailtext = stripslashes($mailtext);
}
$mailSent = @mail($mailTo, $mailSubject, $mailText, "From: ".$mailFrom);
if($mailSent == TRUE) {
header("Location: " . $returnPage);
}
else {
header("Location: " . $returnErrorPage);
}
exit();
?>
当我点击表单中的提交按钮时会有一些加载,然后地址显示www.mywebsite.com/mail.php,其中包含Chrome错误ERR_EMPTY_RESPONSE
但是我收到了包含我表格中所有值的邮件。
我的表单如下:
<form method="post" action="mail.php">
<input type="text" id="name" name="Name" placeholder="Name">
<input type="text" id="mail" name="E-Mail" placeholder="E-Mail">
<input type="text" id="anreise" name="Anreise" placeholder="Anreise">
<input type="text" id="abreise" name="Abreise" placeholder="Abreise">
<input type="text" name="personen" name="Personen" id="personen" placeholder="Personen">
<input type="submit" id="senden" value="Senden">
</form>
我是php的新手,我真的无法弄清楚如何以及为什么所以我希望得到你的帮助!谢谢!