domerdel Posted April 22, 2010 Share Posted April 22, 2010 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("[email protected]"); $mailto = Array("[email protected]"); $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\" <[email protected]>\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\" <[email protected]>\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"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/199411-godaddy-php-form-mail-issue/ Share on other sites More sharing options...
andrewgauger Posted April 23, 2010 Share Posted April 23, 2010 mail($value,$subject,$t_data,str_replace("[to]",$value,$headers)); should be mail($value,$subject,$t_data,str_replace("[to]",$value),$headers); Quote Link to comment https://forums.phpfreaks.com/topic/199411-godaddy-php-form-mail-issue/#findComment-1046787 Share on other sites More sharing options...
oni-kun Posted April 23, 2010 Share Posted April 23, 2010 mail($value,$subject,$t_data,str_replace("[to]",$value),$headers); Why no third parameter? Quote Link to comment https://forums.phpfreaks.com/topic/199411-godaddy-php-form-mail-issue/#findComment-1046792 Share on other sites More sharing options...
andrewgauger Posted April 23, 2010 Share Posted April 23, 2010 oops.. nevermind. I still don't see where "[to]" is in $headers. Quote Link to comment https://forums.phpfreaks.com/topic/199411-godaddy-php-form-mail-issue/#findComment-1046797 Share on other sites More sharing options...
domerdel Posted April 23, 2010 Author Share Posted April 23, 2010 thank you for the replies.. still waiting for this to be solved Quote Link to comment https://forums.phpfreaks.com/topic/199411-godaddy-php-form-mail-issue/#findComment-1046806 Share on other sites More sharing options...
andrewgauger Posted April 23, 2010 Share Posted April 23, 2010 So I did a port scan on relay-hosting.secureserver.net and found they have ONLY port 25 open and that must mean they are the relay agent. You probably will need authentication credentials to connect to it. In an ASP example I found they used the default credentials, so maybe your web server holds the credentials. Either way you are going to have to send your mail through port 25 to relay-hosting.secureserver.net using a means other than mail(). I'd recommend worx phpSendmail or PEAR->smtp I have been trying to get either of these working, but I do not have a web hosting that permits the traffic that these send out. So, what you need to do is instead of using mail(), use smtp communication. OR check your php.ini file for [mail function] SMTP = smtp.domain.name sendmail_from = [email protected] and change SMTP to SMTP= relay-hosting.secureserver.net Quote Link to comment https://forums.phpfreaks.com/topic/199411-godaddy-php-form-mail-issue/#findComment-1046819 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.