flannerz Posted March 26, 2006 Share Posted March 26, 2006 Hi GuysI seem to have a problem with this simple form handling script. The problem is that is seems to send correctly sometimes and then other times it doesn't send at all. Every test I have done has worked perfectly yet my client has said that sometimes people are using the form yet their details never actually arrive.Below is the code (private details blocked out). The address that it is been sent to is an '@tiscali.co.uk'. I'm wondering if this could be the problem.[code]<?$mailto = '******@tiscali.co.uk';$subject = "Enquiry";$formurl = "http://www.******.com/contactus.html";$errorurl = "http://www.******.com/error.html";$thankyouurl = "http://www.******.com/thankyoucontactus.html";$name = $_POST['name'];$address1 = $_POST['add'];$address2 = $_POST['add1'];$town = $_POST['town'];$county = $_POST['county'];$postcode = $_POST['postcode'];$telephone = $_POST['telephone'];$email = $_POST['email'];$from = $_POST['from'];$to = $_POST['to'];$from1 = $_POST['from1'];$to1 = $_POST['to1'];$http_referrer = getenv( "HTTP_REFERER" );if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit;}if (empty($name) || empty($telephone) || empty($email)) { header( "Location: $errorurl" ); exit;}$name = strtok( $name, "\r\n" );$email = strtok( $email, "\r\n" );if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments );}$messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------- Enquiry -------------------------\n\n" . "Contact name - " . $name . "\r\n" . "Address Line 1 - " . $add . "\r\n" . "Address Line 2 - " . $add1 . "\r\n" . "Town/City - " . $town . "\r\n" . "County - " . $county . "\r\n" . "Postcode - " . $postcode . "\r\n" . "Telephone - " . $telephone . "\r\n" . "Email Address - " . $email . "\r\n" . "I would prefer to stay from the " . $from . " to the " . $to . " or alternatively from the " . $from1 . " to the " . $to1 . "\r\n" . "Other Information - " . $comments . "\n\n------------------------------------------------------------------\n";mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" );header( "Location: $thankyouurl" );exit;?>[/code]I'm no expert in PHP so any pointers would be greatThanks Quote Link to comment Share on other sites More sharing options...
flannerz Posted March 29, 2006 Author Share Posted March 29, 2006 Can anyone help me with this? Quote Link to comment Share on other sites More sharing options...
alpine Posted March 29, 2006 Share Posted March 29, 2006 Such faults are hard to determine, i always send mail with the appropriate final message to the user based on the mail status in the end:[code]$sendmail = mail($to,$subject,$header,"-f",$return);if($sendmail){header( "Location: $thankyouurl" );}else{header( "Location: $errorurl" );}[/code] Quote Link to comment 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.