我的投资组合网站有一个非常简单的表格,但它没有发送电子邮件到我的收件箱地址。
这是HTML
<form method="post" action="contact.php">
<label>Name <i class="fa fa-male"> </i> </label> <br />
<input type="text" name="name" /> <br />
<label>Email <i class="fa fa-envelope"> </i> </label> <br />
<input type="email" name="email" /> <br />
<label>Message <i class="fa fa-comment"> </i> </label> <br />
<textarea rows="5" cols="50" name="message"></textarea> <br />
<input type="submit" value="Send" />
</form>
和PHP
<?php
$myemail = 'danieldrave@live.com';
// GET THE CONTENT
$name = $_POST['name'];
$email = $_POST['email'];
$msg = $_POST['message'];
// BUILD THE MESSAGE
$to = $myemail;
$subject = "Client enquiry: $name";
$body = "$msg";
$headers = "From: $email";
// SEND EMAIL
mail($to, $subject, $body, $headers);
// ACKNOWLEDGEMENT OF MESSAGE
header('Location: thankyou.php');
?>
作为参考,该网站成功重定向到thankyou.php
答案 0 :(得分:0)
要考虑的事情: