sonomaairporter Posted March 11, 2009 Share Posted March 11, 2009 Totally new to php, I'm using a wizard to produce the needed php. The email never gets sent. How can I troubleshoot this? # ---------------------------------------------------- # ----- # ----- This script was generated by the demo version of PHP-Form Wizard 1.2.6 on 3/10/2009 at 10:42:01 AM # ----- # ----- http://www.tools4php.com # ----- # ---------------------------------------------------- # ----- # ---------------------------------------------------- // Receiving variables @$PassengerName = addslashes($_POST['PassengerName']); @$PaxNumber = addslashes($_POST['PaxNumber']); @$HomePhone = addslashes($_POST['HomePhone']); @$WorkPhone = addslashes($_POST['WorkPhone']); @$CellPhone = addslashes($_POST['CellPhone']); @$email = addslashes($_POST['email']); @$Comments = addslashes($_POST['Comments']); @$R1ToFrom = addslashes($_POST['R1ToFrom']); @$R1Date = addslashes($_POST['R1Date']); @$R1Menu = addslashes($_POST['R1Menu']); @$R1Airline = addslashes($_POST['R1Airline']); @$R1AirTime = addslashes($_POST['R1AirTime']); @$R1Pickup = addslashes($_POST['R1Pickup']); @$R2ToFrom = addslashes($_POST['R2ToFrom']); @$R2Date = addslashes($_POST['R2Date']); @$R2Menu = addslashes($_POST['R2Menu']); @$R2Airline = addslashes($_POST['R2Airline']); @$R2AirTime = addslashes($_POST['R2AirTime']); @$R2Pickup = addslashes($_POST['R2Pickup']); #@$recipient = addslashes($_POST['recipient']); #@$subject = addslashes($_POST['subject']); #@$required = addslashes($_POST['required']); #@$email_only = addslashes($_POST['email_only']); #@$numbers_only = addslashes($_POST['numbers_only']); #@$sender_email = addslashes($_POST['sender_email']); #@$link_url = addslashes($_POST['link_url']); #@$link_text = addslashes($_POST['link_text']); #@$exclude = addslashes($_POST['exclude']); #@$recipient_name = addslashes($_POST['recipient_name']); // Validation if (strlen($PassengerName) == 0 ) { header("Location: acapulco.html"); exit; } if ( $PaxNumber < 1) { header("Location: acapulco.html"); exit; } if ( $PaxNumber > 100) { header("Location: acapulco.html"); exit; } if (strlen($PaxNumber) == 0 ) { header("Location: acapulco.html"); exit; } if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { header("Location: acapulco.html"); exit; } //Sending Email to form owner $pfw_header = "From: $email\n" . "Reply-To: $email\n"; $pfw_subject = "Web Reservation"; $pfw_email_to = "web@sonomaairporter.com"; $pfw_message = "PassengerName: $PassengerName\n" . "PaxNumber: $PaxNumber\n" . "HomePhone: $HomePhone\n" . "WorkPhone: $WorkPhone\n" . "CellPhone: $CellPhone\n" . "email: $email\n" . "Comments: $Comments\n" . "R1ToFrom: $R1ToFrom\n" . "R1Date: $R1Date\n" . "R1Menu: $R1Menu\n" . "R1Airline: $R1Airline\n" . "R1AirTime: $R1AirTime\n" . "R1Pickup: $R1Pickup\n" . "R2ToFrom: $R2ToFrom\n" . "R2Date: $R2Date\n" . "R2Menu: $R2Menu\n" . "R2Airline: $R2Airline\n" . "R2AirTime: $R2AirTime\n" . "R2Pickup: $R2Pickup\n" . "recipient: $recipient\n" . "subject: $subject\n" . "sender_email: $sender_email\n" . "recipient_name: $recipient_name\n" . "This message was sent by the trial version of PHP-Form Wizard, To Get the full version please use this link: http://tools4php.com/form-wizard/order.html"; @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; header("Location: index.html"); ?> Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted March 11, 2009 Share Posted March 11, 2009 is mail enabled in php.ini ? do you have a smtp server set ? enable all errors on your page and see if it throws an error when running the script Quote Link to comment Share on other sites More sharing options...
kev wood Posted March 11, 2009 Share Posted March 11, 2009 the following code retrieves email address from a mysql db and sends out an email to each address in the db. the $message part of the script is what the recipient will see so just build that up like you would build a normal web page. remember to use absolute file references here though for any images that you want displayed. $message .= '<body leftmargin="0" topmargin="0"> <table width="700" border="0" align="center" cellpadding="0" cellspacing="5"> <tr> <td>The ' . $table . ' section of the <a href="piponline.info"> PiPonline website</a> has been updated. Please follow the link to see the new content. </tr> </table> </body>'; $query = "SELECT * FROM emails"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $contactemail = $row['email']; // Contacts //$replyName = $merc_replyId; //$replyEmail = $merc_replyAddress; $replyName = "PiPonliine"; $replyEmail = "info@piponline.info"; $contactname = ""; // Subject $subject = "Website Update"; // Headers $headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL; $headers .= "From: ".$replyName." <".$replyEmail.">" . PHP_EOL; $headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL; mail($contactemail, $subject, $message, $headers); } Quote Link to comment Share on other sites More sharing options...
sonomaairporter Posted March 11, 2009 Author Share Posted March 11, 2009 LoneWolf217: I can't see the php.ini file on the server, and I don't know what an smtp server set is. kev wood: I see that your mail command is mail($contactemail, $subject, $message, $headers); while mine is @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; Should I remove the @ from my mail command? Quote Link to comment Share on other sites More sharing options...
kev wood Posted March 11, 2009 Share Posted March 11, 2009 you could put i dont know if that will work as your script is being generated for you by the wizard you are using. what is the need of this email being sent? if you tell us more about why you need this email sending out then we can better help find you a solution to your problem. Quote Link to comment Share on other sites More sharing options...
sonomaairporter Posted March 11, 2009 Author Share Posted March 11, 2009 My business is an airport shuttle service which requires advance reservations. On my web site is a Reservation Request Form which after being filled out is emailed to us. I had another php template which worked perfectly til about a year ago. Then suddenly the emails quit coming. So I've had the form disabled since then. I decided to try to figure out what is going wrong. So, I downloaded another wizard which made a much simpler php file that I could understand. To see the form that's being filled out: http://www.sonomaairporter.com/reservationOrg.html Again, our two Mail commands look identical, except that mine starts with an @ (like a lot of the other code in this php file). Is that a problem or not? Quote Link to comment Share on other sites More sharing options...
kev wood Posted March 12, 2009 Share Posted March 12, 2009 this could easily be done with out the help of a wizard. how i would go about this would be to have your form filled out on one page then post all the date to a proccessing page which then takes all the information from the form and generates the email to be sent to you. can you post the code for the form. 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.