We use a php email form on a website, it works fine when delivering email to other email programs, just not gmail, ive checked the spam and the inbox, but i get nothing, its as if gmail dosnt trust the email and completly ignores it. How can we get them to come through ?
the code im using for the form is :
<div id="contact-form">
<form id="commentForm" action="assets/php/mail.php" method="POST">
<input type="text" name="name" class="required" placeholder="Name..">
<input type="text" name="email" class="required email" placeholder="Email..">
<input type="text" name="phone" class="required" placeholder="Phone..">
<textarea name="message" placeholder="Message.." class="required"></textarea><br />
<input class="subm" type="submit" value="Submit..">
</form>
</div>
and the php is
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Contact Form Confirmation</title>
<meta http-equiv="refresh" content="4; url=http://www.domain.co.uk">
</head>
<body>
<?php $name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$formcontent="
<h1>From :</h1> $name \n
<h1>Email :</h1> $email \n
<h1>Phone :</h1> $phone \n
<h1>Message :</h1> $message
";
$recipient = "studio@domain.co.uk";
$subject = "Contact Form";
$mailheader = "MIME-Version: 1.0" . "\r\n";
$mailheader .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$mailheader .= "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo("<p>Thanks for getting in touch, we'll get back to you shortly..</p>");
?>
</body>
</html>
GMail is not the only mail service that will ignore sendmail emails.
Likely, the cause is that your From: header doesn’t match your mail server host name. If you’re using 3rd-party hosting, you should find out the host name (e.g. “myhost.com”) and use that in your From: header. Then use the correct email address in the “Reply-To” header instead.
To increase deliverability, you should use SMTP to send a mail via an actual email account.
To absolutely maximize deliverability, you should use an ESP.