Jump to content

Recommended Posts

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\">";
}
?>

---------------------

Link to comment
https://forums.phpfreaks.com/topic/53742-help-with-my-php/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/53742-help-with-my-php/#findComment-265591
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.