In my headers field, the actual email exists on a non-godaddy server (MS Exchange), so my contact form is validating fine, but it's not relaying the information from the captured form to the destination email. I called Godaddy, and they told me I need to include:
relay-hosting.secureserver.net
I'm not sure how to include that into my mail.php file. Here's my code:
<?php
error_reporting(1);
// user_subject field. This is the subject that is sent to the user.
// you can replace any fieldname on the form with [fieldname]
// edit the mail_user_template.tpl to change the body of the email
$user_subject = "Regarding Your Inquiry";
$template_file = "mail_user_template.tpl";
//$mailto = Array("info@reddinghomehelpers.com");
$mailto = Array("delello@gmail.com");
$subject="Web Inquiry: {$_POST['name']} - {$_POST['department']}";
// captcha stuff
session_start();
require_once ('securimage/securimage.php');
$securimage = new Securimage();
unset($_SESSION['captcha']);
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// handle the error accordingly with your other error checking
foreach( $_POST as $k=>$v )
$_SESSION[$k]=$v;
$_SESSION['captcha']="failed";
// or you can do something really basic like this
header("location: contact.php");
exit();
}
if ( $_POST['tpl'] )
$t_data=file_get_contents("mail_contact.tpl");
else
$t_data = file_get_contents("mail_template.tpl");
$user_data = file_get_contents("mail_user_template.tpl");
foreach($_POST as $key=>$value) {
$t_data=str_replace("[".$key."]",$value,$t_data);
$user_subject=str_replace("[".$key."]",$value,$user_subject);
$user_data=str_replace("[".$key."]",$value,$user_data);
}
if ( $_POST['companyname'] )
$fromname=$_POST['companyname'];
elseif ( $_POST['name'] )
$fromname = $_POST['name'];
else
$fromname = $_POST['firstName'] . " " . $_POST['lastName'];
$headers = "MIME-Version: 1.0\n".
"Content-type: text/html; charset=iso-8859-1\n".
"From: \"ReddingHomeHelpers.com\" <info@reddinghomehelpers.com>\n".
"Reply-To: \"" . $fromname . "\" <".$_POST['email'].">\n".
"Date: ".date("r")."\n";
foreach($mailto as $value) {
mail($value,$subject,$t_data,str_replace("[to]",$value,$headers));
}
// this is for the user's email
$headers = "MIME-Version: 1.0\n".
"Content-type: text/html; charset=iso-8859-1\n".
"From: \"ReddingHomeHelpers.com\" <info@reddinghomehelpers.com>\n".
"Date: ".date("r")."\n";
mail($_POST['email'], $user_subject, $user_data,$headers);
// Ok so now we send out confirm email.
// Dom
header("location: thank_you.html");
?>