【发布时间】:2014-01-20 01:46:21
【问题描述】:
我一直在尝试设置联系表单以将信息发送到我的电子邮件。我检查了代码,没有语法错误或任何东西,但我没有收到任何测试电子邮件。你能帮帮我吗?
这是 HTML:
<!--Start of Contact Form-->
<div class="large-7 medium-10 small-12 medium-centered large-centered column">
<div class="row">
<form method="post" action="email2.php">
<input type="text" name="name" class="defaultText" title="your name">
<input type="text" name="email" class="defaultText" title="your email address">
<textarea name="comments1" class="defaultText" title="Tell us about your business"></textarea>
<textarea name="comments2" class="defaultText" title="How can we help?"></textarea>
<div class="large-7 medium-10 small-12 medium-centered large-centered column">
<input type="submit" name="send message" value="Send Message">
</div>
</form>
</div>
</div>
<!--End of Contact Form-->
这是脚本:
<?php
if (isset($_POST['email']))
//if "email" is filled out, send email
{
//send email
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments1 = $_POST['comments1'] ;
$comments2 = $_POST['comments2'] ;
mail("info@muzedimage.com", $name, $email, $comments1, $comments2
, "From:" . $email);
echo "<script>window.location = 'http://www.muzedimage.com'</script>";
}
else
//if "email" is not filled out,
{
echo "<script>window.location = 'http://www.muzedimage.com/contact'</script>";
}
?>
非常感谢各位的帮助。
【问题讨论】:
-
问题在于如何将这些变量分配给它们的特定参数。您提供的标题不正确,因此邮件被拒绝。请read more about mail().
-
人们只是猜测函数接受的参数吗?