I'm trying to have a contact form on my page. Nothing crazy, just a simple form. I've tried multiple contact forms from the web, and they all look fine, they all work fine when filling it out on my site and even when you hit submit it brings you to the PHP page fine and everything, but I never get the message in my email. I've checked my spam and everything and I'm just not getting the message.
Here's the form html:
<form method="post" action="sendit.php">
<label for="Name">Name:</label>
<input type="text" name="Name" id="Name" />
<label for="Phone">Phone:</label>
<input type="text" name="Phone:" id="Phone" />
<label for="Email">Email:</label>
<input type="text" name="Email" id="Email" />
<label for="Message">Message:</label>
<textarea name="Message" rows="20" cols="20" id="Message"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>
Here's the PHP:
<?php
$EmailFrom = "mjd8079@yahoo.com";
$EmailTo = "mjd8079@yahoo.com";
$Subject = "Contact";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=sendit.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>