Jump to content

mail.php file doesn't work


orr16875

Recommended Posts

I've wrote a mail.php file and i'm trying to send the form thru it. i don't get any errors, but since i did it, i don't get the form to the email (after being validated with JS ), and the user should get a "thankyou.html" page but i get a blank page instead. how should i do the "thankyou.html" page.there is the mail.php code:<html><body><? php$to = "info@inhomeestimates.com";$subject= $_REQUEST['Project:'];$headers .= 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";$Date = $_REQUEST['Date'];$Project: = $_REQUEST['Project:'];$Description = $_REQUEST['Description'];$schedule = $_REQUEST['schedule'];$FirstName = $_REQUEST['FirstName'];$LastName = $_REQUEST['LastName'];$Address = $_REQUEST['Address'];$City = $_REQUEST['City'];$State = $_REQUEST['State'];$Zip = $_REQUEST['Zip'];$HomePhone = $_REQUEST['HomePhone'];$WorkPhone = $_REQUEST['WorkPhone'];$Cell = $_REQUEST['Cell'];$email = $_REQUEST['eMail'];$Estimates = $_REQUEST['Estimates'];$Budget = $_REQUEST['Budget'];$Advertising = $_REQUEST['Advertising'];$agree = $_REQUEST['agree'];mail("$to, $subject:, "from: $eMail");header("Location: http://www.inhomeestimates.com/thankyou.html");?>

Link to comment
Share on other sites

mail("$to, $subject:, "from: $eMail");Take out that first quote. It should be like this:mail($to, $subject:, "from: $eMail");It doesn't redirect because there is a syntax error and it is not parsing the strings correctly. You probably have errors turned off on the server, or you would see the error instead of a blank page. This is how these two lines are being parsed (strings are in green):[mail("$to, $subject:, "from: $eMail");header("Location: http://www.inhomeestimates.com/thankyou.html");The error would have been a parse error because the string never ends, or a syntax error because it sees the "from" as a statement instead of a string. You also could have seen this error for yourself if you were using an editor with syntax highlighting instead of Notepad.

Link to comment
Share on other sites

thank you justsomeguy,i've downloaded "phpED" and it's a lot easier that way. the only thing is i'm getting now a warning:Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() Can i fix this within the script, and not on my computer (because what will happen in the client side? )

<?php$to =				'info@inhomeestimates.com';$subject=			$_REQUEST['Project'];$headers .=		 'From:etimate required'. "\r\n";	   $Date = 			$_REQUEST['Date'];$Project = 			$_REQUEST['Project:'];$Description = 		$_REQUEST['Description'];$schedule = 		$_REQUEST['schedule'];$FirstName = 		$_REQUEST['FirstName'];$LastName = 		$_REQUEST['LastName'];$Address = 			$_REQUEST['Address'];$City =	 			$_REQUEST['City'];$State = 			$_REQUEST['State'];$Zip = 				$_REQUEST['Zip'];$HomePhone = 		$_REQUEST['HomePhone'];$WorkPhone = 		$_REQUEST['WorkPhone'];$Cell =		 		$_REQUEST['Cell'];$email = 			$_REQUEST['eMail'];$Estimates = 		$_REQUEST['Estimates'];$Budget = 			$_REQUEST['Budget'];$Advertising = 		$_REQUEST['Advertising'];$agree = 			$_REQUEST['agree'];mail($to, $subject ,$message, $headers);?>

Link to comment
Share on other sites

It's not a client error, it's a server error. PHP cannot connect to a mail server to send the mail. Chances are you are developing this at home and don't have a mail server installed on the server where PHP is running. If that's the case, and you are planning on moving this script online when you are finished (and off your personal computer), you can probably ignore this error, because the online server will have a mail server that PHP can use to send the mail. Or you can install your own SMTP server and try to send the mail from your test server, but your ISP might also be blocking the SMTP port, so the mail wouldn't be sent anyway.

Link to comment
Share on other sites

ok, now it's all online: www.inhomeestimates.com and it's being hosted by "godaddy". there is a mail server - a webmail (webbased) email, so i guess there is no problem with the server any more (is there ?) but yet when i click "submit" on one of the forms (ac.html), i still get a blank page.you can see all the files on the server - but only the ac.html is linked to the mail.php (for now)help is needed and appreciated :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...