Jump to content

Recommended Posts

Posted

Let me start by professing my admitted lack of .php prowess. Ok, that out of the way:

I have a contact form that I "fixed" for someone a few years ago that has been working fine since but apparently about a week ago is has begun to fail. It sends emails fine from some users, but not at all from others, in both cases forwarding to success page. Any ideas? On a shared Godaddy server and using jacks formmail.php, but like I said, worked fine until a few weeks ago. Any ideas where to trouble shoot first? Thanks in advance.

 

EDIT:Problem solved. Solution: Do not rely upon your client to properly explain any web related problems. Thanks for all the replies:)

  • 3 weeks later...
Posted

Nope, I was wrong the problem persists. (though the not relying upon clients part is still valid)

 

I threw out the script I was using and am processing it with a script I pieced together using Matt Varone's sendmail.

 

Same problem remains: certain emails do not get sent even though the form redirects to the thanks page. If anyone has any ideas, stories, anything, I'm out of options.

 

Here's the script:

<?php 
# ------------------------------------------------------------ 
// PHP CONTACT FORM SCRIPT v1.0 
// By Matt Varone | http://www.mattvarone.com 
# ------------------------------------------------------------ 

# ------------------------------------------------------------ 
// General Configuration 
# ------------------------------------------------------------  

// Name of the website. 
$szFrom = "Orlando Villa Rentals- Owners";  

// Your email, (the recipient email address). 
$szRecipient = "nick@xxxxx.com, mick@xxxxxxxx.com";   

// Website email address ( Sender's email address ). 
$szFromEmail = "donotreply@xxxxx.com";   

/* Title comes from a hidden input in the form. This gives 
the possibility to set up more than one form and use this same script.*/ 
$szTitle = $_POST['title'];   

// This sets up the email subject. 
$szSubject = $szFrom.": ".$szTitle;   

/* All input fields coming from the form/s should go here. 
The first value is the name attribute used and the second 
value on the right the name wanted to display 
on the final email.*/  

$aPosted = array( 
   "realname" => "Name", 
   "floridahome" => "Florida Home", 
   "email" => "Email Address", 
   "headname" => "Head of Party", 
"adults" => "Adults", 
"children" => "Children", 
"from" => "From Date", 
"to" => "To Date", 
"cot" => "Cot Hire", 
"flightdetails" => "Fight Details", 
"other" => "Comments and Special Requests", 
   // add here your fields 
);  

# ------------------------------------------------------------ 
// Email Content 
# ------------------------------------------------------------  

$szEmailContent.= $szSubject."\n";
$szEmailContent.= "------------------------------------------------------------\n\n"; 
$szLast = ""; 

foreach($aPosted as $value => $szReal) 
{ 
       if(isset($_POST[$value])) 
       { 
               if($szLast != $szReal) 
               { 
                       $szEmailContent.= $szReal.":"; 
                       $szLast = $szReal; 
               }; 

               $szEmailContent.= " ".$_POST[$value]."\n\n"; 
       }; 
}; 

# ------------------------------------------------------------ 
// Declare Email headers 
# ------------------------------------------------------------  

$szHeaders = 'From: ' . $szFromEmail . "\r\n" . 'Reply-To: ' . $szFromEmail . "\r\n" . 'X-Mailer: PHP/' . phpversion(); 

# ------------------------------------------------------------ 
// Output 
# ------------------------------------------------------------  

if( mail( $szRecipient, $szSubject, $szEmailContent, $szHeaders, '-f' . $szFromEmail ) ) 
   // go to previous page ($lasturl) with message=1 (should be a succes message). 
   header( 'Location: http://' . $_SERVER['HTTP_HOST']  . html_entity_decode( $_POST['lasturl'] ) . '/owners/thanks.htm' ); 
else 
   // go to previous page ($lasturl) with message=2 (should be a failure message). 
   header( 'Location: http://' . $_SERVER['HTTP_HOST']  . html_entity_decode( $_POST['lasturl'] ) . '/owners/error.htm' );        

?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...