联系表格没有发送电子邮件

时间:2018-02-24 22:45:23

标签: php html

<form action="" method="post">
    <input placeholder="Ονομα" name="name" type="text" required />
    <input placeholder="Email" name="mail" type="email" required />
    <input placeholder="Θεμα" name="subject" type="text" required />
    <textarea name="message" placeholder="Μήνυμα"></textarea>
    <input class="formBtn" name="submit" type="submit" />
  </form>
  <?php

if (isset($_POST['submit'])) {
  $name = $_POST['name'];
  $subject = $_POST['subject'];
  $mailfrom = $_POST['mail'];
  $message = $_POST['message'];

  $mailTo = "myemail";
  $headers = "From: ".$mailfrom;
  $txt = "You got a new mail from ".$name.".\n\n".$message;

  mail($mailTo, $subject, $txt, $headers);
  header("Location: form.php?mailsend");
}
?>

myemail就是一个例子。原始代码有我的个人电子邮件。

因此,当运行此代码并填写表单时,它会到达终点(显示mailsend消息)。但是,当我搜索我的电子邮件时,不存在。我尝试了30次,没有人来到我的邮箱 谢谢。

0 个答案:

没有答案