I'm trying to set up a contact me page and currently I've got it working all the way to the point of the 'message sent' result showing up correctly. However the e-mail never shows up for me in my box inbox.
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$antispam = $_POST['antispam'];
$to = 'myemailaddress@gmail.com';
$from = 'From : ' . $email;
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($antispam == '10' || 'Ten' || 'ten') {
$human = true;
}
if($_POST['submit'] && $name != "" && $email != "" && $message != "" && $subject != "") {
if ($human == true) {
if (mail($to, $subject, $body, $from)) {
$result = "Your message was sent successfully!";
} else {
$result = "Something went wrong! Try sending your message again";
}
} else {
$result = "You answered the anti-spam answer incorrectly. Please try again.";
}
} else {
$result = "You did not fill out a required field. Please try again.";
}
?>
<?php echo $result; ?>
I've read seperately that Gmail has issues with PHP mail(), is that possibly the cause?