Jump to content

GoDaddy PHP form mail issue -


domerdel

Recommended Posts

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");
?>

 

Link to comment
Share on other sites

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 = somebody@domain.name

 

and change SMTP to

SMTP= relay-hosting.secureserver.net

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.