wetgorilla Posted May 31, 2007 Share Posted May 31, 2007 Hi, I've created a PHP file to parse my form data. However, after running numerous checks using echos to validate whether or not my server was receiving the data (and it was) I am exhausted. lol It appears for some reason I am not receiving the data in an email as intended. I don't know what is wrong with the mail(); I have checked with my server and that particular code is not being blocked for security reasons and I am running PHP 4.4 Can anyone scan through my php file and find something that looks abnormal? I would greatly greatly greatly appreciate it. I'm on a deadline and I'm about to shoot myself over this. Jerry ---------------------------- <?php // get posted data into local variables $EmailTo = "mroutside@yahoo.com"; $Subject = "Toyota Show Inquiry"; $FirstName = Trim(stripslashes($_POST['FirstName'])); $LastName = Trim(stripslashes($_POST['LastName'])); $Address = Trim(stripslashes($_POST['Address'])); $City = Trim(stripslashes($_POST['City'])); $State = Trim(stripslashes($_POST['State'])); $PostCode = Trim(stripslashes($_POST['PostCode'])); $HomeTel = Trim(stripslashes($_POST['HomeTel'])); $Email = Trim(stripslashes($_POST['Email'])); $Vehicle = Trim(stripslashes($_POST['Vehicle'])); $Forcast = Trim(stripslashes($_POST['Forcast'])); $Status = Trim(stripslashes($_POST['Status'])); $From = $Email; // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "First Name: "; $Body .= $FirstName; $Body .= "\n"; $Body .= "Last Name: "; $Body .= $LastName; $Body .= "\n"; $Body .= "Address: "; $Body .= $Address; $Body .= "\n"; $Body .= "City: "; $Body .= $City; $Body .= "\n"; $Body .= "State: "; $Body .= $State; $Body .= "\n"; $Body .= "Zip: "; $Body .= $PostCode; $Body .= "\n"; $Body .= "Phone: "; $Body .= $HomeTel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Interested Vehicle: "; $Body .= $Vehicle; $Body .= "\n"; $Body .= "Purchase Forcast: "; $Body .= $Forcast; $Body .= "\n"; $Body .= "Current Toyota Owner: "; $Body .= $Status; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$From>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=toyotaShow_thankyou.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=toyotaShow_error.html\">"; } ?> --------------------- Quote Link to comment https://forums.phpfreaks.com/topic/53742-help-with-my-php/ Share on other sites More sharing options...
per1os Posted May 31, 2007 Share Posted May 31, 2007 The mail function does not always return what is expected. It can return false and the email is sent, vice versa it can return true and no email is being sent. I would suggest looking up www.php.net/mail the mail function and looking at the headers of an email and maybe even the -f portion and try those out. Also depending on what email address you are sending to, it will probably be filtered out as spam. Most Hotmail, Yahoo and AOL mail accounts do not accept generic emails without more mail headers from places. Some times they will not except mail from your server period. It is really a tossup. Quote Link to comment https://forums.phpfreaks.com/topic/53742-help-with-my-php/#findComment-265591 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.