为什么这个基本的PHP联系表不会发送电子邮件?

时间:2016-07-03 20:34:09

标签: php html

我没有收到任何电子邮件。 " name"," email"," message"是正确的名字。 我是否必须使用提交按钮执行某些操作?

<input type="submit" name="submit" value="Submit" />

我认为这可能是个问题

我的托管服务提供商是Godaddy,所以PHP可以运行。

<?php

// Assign the input values to variables for easy reference
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];

$to = "aroncea@yahoo.com";
$subject = "Contact Form: $name";
$message = "$message";
$headers = 'From: aroncea@yahoo.com' . "\r\n" .
    'Reply-To: ' . $email . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

// Die with a success message
die("<span class='success'><h3>Successfully Sent!</h3> Your message is on its way, we will respond to you shortly.</span>");

?>

&#13;
&#13;
<!-- Container (Contact Section) -->
<form action="newcontact.php" method="POST"  name='contactform' id='contactform' enctype="text/plain">
<div id="contact" class="container-fluid bg-grey">
  <h2 class="text-center">CONTACT</h2>
  <div class="row">
    <div class="col-sm-5">
      <p>Contact us and we'll get back to you within 24 hours. </p>
      <p><span class="glyphicon glyphicon-map-marker"></span> Burlington, ON</p>
      <p><span class="glyphicon glyphicon-phone"></span> 289-230-4510</p>
      <p><span class="glyphicon glyphicon-envelope"></span> aroncea@yahoo.com</p>
    </div>
    <div class="col-sm-7 slideanim">
      <div class="row">
        <div class="col-sm-6 form-group">
          <input class="form-control" id="name" name="name" placeholder="Name" type="text" required>
        </div>
        <div class="col-sm-6 form-group">
          <input class="form-control" id="email" name="email" placeholder="Email" type="email" required>
        </div>
      </div>
      <textarea class="form-control" id="comments" name="message" placeholder="Comment (not required)" rows="3"></textarea><br>
      <div class="row">
        <div class="col-sm-12 form-group">
          <input type="submit" name="submit" value="Submit" />
        </div>
      </div>
    </div>
  </div>
&#13;
&#13;
&#13;

0 个答案:

没有答案