I am having issues getting a simple contact form getting past the junk filter and into the inbox. Is there something wrong with my code?
I have tried to set the email to ‘not junk’ in the 2 different email providers, but no change.
Here is my code:
<form method="post" action="mail_.php">
<label>Name</label>
<input name="name" placeholder="Type Here">
<label>Email</label>
<input name="email" type="email" placeholder="Type Here">
<label>Message</label>
<textarea name="message" placeholder="Type Here"></textarea>
<label>*What is 7+3? (Anti-spam)</label>
<input name="human" placeholder="Type Here">
<input id="submit" name="submit" type="submit" value="Submit">
</form>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: Contact Form';
$to = 'my_email@gmail.com';
$subject = 'Hello';
$human = $_POST['human'];
$body = "From: $name\
E-Mail: $email\
Message:\
$message";
$headers .= "Content-type: text/plain; charset=utf-8\
";
$headers .= "From: website user<someone_from@mysite.com> \
";
if ($_POST['submit']) {
if ($name != '' && $email != '') {
if ($human == '10') {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}
} else if ($_POST['submit'] && $human != '4') {
echo '<p>You answered the anti-spam question incorrectly!</p>';
}
} else {
echo '<p>You need to fill in all required fields!!</p>';
}
}
?>
Any help would be much appreciated.