I don't know PHP very well and am trying to get a very simple PHP script to send emails. When submit is clicked I get the Thank You message but no email.
<?php $name = $_POST['name'];
$email = $_POST['email'];
$web = $_POST['web'];
$message = $_POST['message'];
$formcontent="From: $name \n Website: $web \n Message: $message";
$recipient = "[email protected]"; // I do have my email here
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
here is the form html:
<form action="mail.php" method="post" class="form">
<p class="name">
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</p>
<p class="email">
<label for="email">E-mail</label>
<input type="text" name="email" id="email" />
</p>
<p class="web">
<label for="web">Website</label>
<input type="text" name="web" id="web" />
</p>
<p class="text">
<label for="web">Comments</label>
<textarea name="message"></textarea>
</p>
<p class="submit">
<input type="submit" value="Send" />
</p>
</form>
mailerror is.. alternatively you can use an already built class likePHPMailer.mail()may not be received, such as your development environment doesn't have an SMTP server running, it went to spam (this is super common) your ISP blocks outbound messages, and on and on. Do you have an SMTP server? Can you read its logs?mail().