使用PHP表单发送电子邮件不起作用 - PHP

时间:2014-04-22 04:02:52

标签: javascript php html forms email

我有以下PHP页面:

<?php
//if "email" variable is filled out, send email
  if (isset($_REQUEST['email']))  {

  //Email information
  $admin_email = "someone@example.com";
  $email = $_REQUEST['email'];
  $subject = $_REQUEST['subject'];
  $comment = $_REQUEST['comment'];

  //send email
  mail($admin_email, "$subject", $comment, "From:" . $email);

  //Email response
  echo "Thank you for contacting us!";
  }

  //if "email" variable is not filled out, display the form
  else  {
?>

 <form method="post">
  Email: <input name="email" type="text" /><br />
  Subject: <input name="subject" type="text" /><br />
  Message:<br />
  <textarea name="comment" rows="15" cols="40"></textarea><br />
  <input type="submit" value="Submit" />
  </form>

<?php
  }
?>

然后我将表单填入我的@gmail.com电子邮件中,但它不起作用......我没有收到任何内容......为什么?我究竟做错了什么? Gmail或任何其他电子邮件提供商是否阻止?我怎样才能让它发挥作用?

0 个答案:

没有答案