Form to email problem - Need help please

Hi All,

Please forgive my technical ignorance. I am only able to explain my problem in non-tech language, but hopefully some kind soul can help me?

I have and html form on my website that when submitted sends 2 emails using PHP mail function. The first is sent to me telling me someone has submitted the form, and what page it was sent from. The second email is sent to the email address of the submitter. The mailing for both is done from the same PHP script. All works well on my primary domain.

I then added two more domains using cpanel, and uploaded the very same form and script to each of them. Now my problem is that when the form is submitted on these new added domains, only the email to me is sent. The email to the submitter is not received. I checked that the “From” email is a real email on the same domain as the script. I get no error messages.

Any help or advice would be warmly welcomed!

you will need to post a sample of your script. use the

 tags when posting it.

Code as requested

 

/* Email address where the messages should be delivered */
$to = 'john@printbuyers.co.uk';

/* This will be appended to the subject of contact form message */
$subject = 'Enquiry';

/* Thank you message to be displayed after the form is submitted. Can include HTML tags. Write your message between <!-- Start message --> and <!-- End message --> */
$thank_you_message = <<<EOD
<!-- Start message -->
<p>We have received your message. If required, we'll get back to you as soon as possible.</p>
<p>You'll now be redirected in 5 seconds.</p>
<br /><br /><br /><br /><br /><br /><br /><br />
<!-- End message -->
EOD;

/* Meta Redirect Tag */
$meta_redirect = '</head>
<meta http-equiv="refresh" content="2;url=http://www.trustleads.co.uk/ok1.htm">
';

/* Header */
$header = '
<html>
<head>
<title>Please verify</title>
</head>
<style type="text/css">
body {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
background: #FFFFFF;
line-height: 14px;
}
</style>
<body>
<br /><br />
<br /><br />
<br /><br />
';



/*******************************************************************************
 *	Do not change anything below, unless of course you know very well 
 *	what you are doing :)
*******************************************************************************/

$label_code_invalid = '';
$fmessage = '';

?>

<?php

if (!isset($_POST['submit'])) {

  die("Invalid access");

} else { //form submitted

?>

<?php

		if ($_POST['verify'] == 'true') {

        $error = 0;        
       
        	include_once "securimage.php";
      		$securimage = new Securimage();
          $valid = $securimage->check($_POST['captcha_code']);
      
        if(!$valid) {
            $error = 1;
            $label_code_invalid = '<br /><strong><span style="color:#FF0000;">Incorrect code</span></strong>';
            
          ?>
            
      	 <body bgcolor="#FFFFCC">

			<p align="center">echo $GLOBALS['header']; </p>

          <?php
     
       		showForm();
      
        } else {
        
        	foreach ( $_POST as $key => $value ) {
          if ($key != 'captcha_code' && $key != 'verify' && $key != 'submit') {
          $fmessage .= $key .': ' .$value ."\\r\
";
          }
          }
          
          $from = $_POST['email'];    	
                   
          mail($to,"$subject",$fmessage,"From: $from");
          
          $new_header = str_replace("</head>", $GLOBALS['meta_redirect'], $GLOBALS['header']);
          echo "$new_header";
          echo "<div align=\\"center\\">".$GLOBALS['thank_you_message']."</div>";
          echo "</body></html>";
             	
        }
    }
        
     else {
     	
       echo $GLOBALS['header'];   	
     	
     	 showForm();
     	
    }   

} //else submitted



function showForm()

{
	
//Check if form referrer is set
if (empty($_POST['referrer'])) {
	// Check if referrer exists
	if (!empty($_SERVER['HTTP_REFERER'])) {
		$referring_page = $_SERVER['HTTP_REFERER'];
	}
	else {
		$referring_page = '';
	}
}
else {
	$referring_page = $_POST['referrer'];
} 	
  
echo <<<EOD
<div style="width:400px;vertical-align:top;text-align:center;background-color:#F7F8F7;border: 1px #CCCCCC solid;overflow:visible;margin:auto;" id="formContainer">
<font size="2" face="Verdana" color="#800000"><h2>Verification</h2>
<form method="post" class="contactForm">
<fieldset style="border:none;text-align:center;">
<p><img id="captcha" src="securimage_show.php" alt="CAPTCHA Image" /></p>
<p><input type="text" name="captcha_code" size="10" maxlength="5" />{$GLOBALS['label_code_invalid']}</p>
<p><font size="2" face="Verdana" color="#800000">
To help us to avoid spam please enter the text<br /> shown in the image above<br /> <font size="1" face="Verdana" color="#800000">(Text is not case sensitive.)<br />
<a href="#" onclick="document.getElementById('captcha').src = 'securimage_show.php?' + Math.random(); return false"><br />Click here if you cannot read the code.</a>
</p>
<input type="hidden" name="verify" value="true" />

EOD;

foreach ( $_POST as $key => $value ) {
if ($key != 'captcha_code' && $key != 'verify' && $key != 'submit') {
print '<input type="hidden" name="'. $key . '" value="' . $value . '" />' . "\
";
}
} 

echo <<<EOD
<input type="hidden" name="referrer" value="{$referring_page}" />
<input type="submit" name="submit" value="Click Here To Send Enquiry" style="font-family: Verdana; font-size: 10pt;
color: #FFFF00; font-weight: bold; background-color: #800000" />
</fieldset>
</form>
</div>
</body>
</html>
EOD;

}

function clean_var($variable) {
    $variable = strip_tags(stripslashes(trim(rtrim($variable))));
  return $variable;
}

?>

<?php

$email = $_POST["email"];

$myname = "John";
$mymail = "john@printbuyers.co.uk";

$subject = "Your enquiry";
$body = "Hi,

$headers = "Content-Type: text/plain; charset=us-ascii\
From: $myname <$mymail>\
Reply-To: <$mymail>\
Return-Path: <$mymail>\
X-Mailer: PHP";

if ($email != "") { mail($email,$subject,$body,$headers); }

?>


The submitter email is only sent when the following conditions are met:

[list][]isset($_POST[‘submit’])
[
]$_POST[‘verify’] == ‘true’
[*]$valid is truthy[/list]

$valid is from $securimage->check($_POST[‘captcha_code’])

If submit and verify are as they should be, is it likely that the captcha code is domain specific?