Sunday, 15 September 2013

Some contact form emails not being sent due to spam filtering on host

Some contact form emails not being sent due to spam filtering on host

I need my contact form on my website to be adjusted. It's a PHP/Ajax
Contact Form.
Currently i have a problem - When a client fills out my contact form NAME
- EMAIL - SUBJECT - MESSAGE there is an issue with my DREAMHOST Server due
to their new anti spam policy and i dont receive some messages - If their
email is @hotmail.com that's fine. But if their email is @gmail.com i dont
get the message etc.
DREAMHOST TELLS ME:
Thanks for contacting Tech Support I checked the logs for the form on your
site and did see that the emails are being bounced by the server due to
recently implemented anti spam policies which won't allow email sent from
the server using non-Dreamhost outgoing servers or "send from" email
addresses. You can read more details on this policy here:
http://wiki.dreamhost.com/Sender_Domain_Policy_and_Spoofing
Your mail form uses the visitor's email address as the 'From' address
which in most cases is not a Dreamhost hosted email address. Due to the
spam policy above, the server will block mail being sent off the server if
the email addresses are not using Dreamhost mail servers. So what you will
need to do is either set the mail form to use your Dreamhost hosted
address as the 'From' address.
Or you will need to find another mail form that will allow you to set a
fixed email address as the 'From' address. This way you can set a
Dreamhost hosted email address in the form as the 'From' address.
THE CODE AS FOLLOWS:
<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/
*/
include dirname(dirname(__FILE__)).'/config.php';
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if($post)
{
include 'functions.php';
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
$error = '';
// Check name
if(!$name)
{
$error .= 'Please enter your name.<br />';
}
// Check email
if(!$email)
{
$error .= 'Please enter an e-mail address.<br />';
}
if($email && !ValidateEmail($email))
{
$error .= 'Please enter a valid e-mail address.<br />';
}
// Check message (length)
if(!$message || strlen($message) < 15)
{
$error .= "Please enter your message. It should have at least 15
characters.<br />";
}
if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());
if($mail)
{
echo 'OK';
}
}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}
}
?>
All i need to know is what i need to do to the code so i can receive all
submissions of my contact form. I would really be grateful if someone
could help.

No comments:

Post a Comment