Paul_Blackpool Posted August 21, 2012 Share Posted August 21, 2012 I am at the email stage of the book, however I have come across a problem. Below id the error message I am getting. I am using xampp on a local server. The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. I also attach the page code below. Any help would be apreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Me</title> </head> <body> <h1>Contact Me</h1> <?php # Script 10.1 - email.php // Check the form submission: if (isset($_POST['submitted'])) { // Minimal form validation if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['comments']) ) { // Create the body: $body = "Name: {$_POST['name']}\n\nComments: {$_POST['comments']}"; // Make it no longer than 70 caracters long: $body = wordwrap($body, 70); // Send the mail: mail('paul@me.co.uk', 'Contact form submission', $body, "From {$_POST['email']}"); // Print a message: echo '<p><em>Thank you for contacting me. I will reply some day.</em></p>'; // Clear $_POST (So that the forms not sticky): $_POST = array(); } else { echo '<p style="font-weight: bold; Color: #c00">Please fill out the form completley.</p>'; } } // End of main isset() IF. // Create the HTML form ?> <p>Please fill out this form to contact me.</p> <form action="mail.php" method="post"> <p>Name: <input type="text" name="name" size="30" maxlengh="60" value="<?php if (isset($_POST['name'])) echo $_post['email']; ?>" /></p> <p>Email Address: <input type="text" name="email" size="30" maxlengh="80" value="<?php if (isset($_POST['email'])) echo $_post['email']; ?>" /></p> <p>Comments: <textarea name="comments" rows="5" cols="30"><?php if (isset($_POST['comments'])) echo $_post['comments']; ?> </textarea></p> <p><input type="submit" name="submit" value="Send!" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form> </body> </html> Link to comment Share on other sites More sharing options...
Larry Posted August 21, 2012 Share Posted August 21, 2012 What is the URL of the page on which you see that message? Link to comment Share on other sites More sharing options...
Paul_Blackpool Posted August 21, 2012 Author Share Posted August 21, 2012 http://localhost/scripts/mail.php Link to comment Share on other sites More sharing options...
lalarukh12 Posted August 21, 2012 Share Posted August 21, 2012 in the url your file's name is mail.php but in your script , at the script top you ve written email.php ... ? Check whether the names match Link to comment Share on other sites More sharing options...
Edward Posted August 21, 2012 Share Posted August 21, 2012 Well the file you have above there is email.php, so can you check in your scripts folder if you can find mail.php? You need to make sure the email.php and mail.php are both in the same folder. Link to comment Share on other sites More sharing options...
Paul_Blackpool Posted August 21, 2012 Author Share Posted August 21, 2012 Sorted out the mail v email.php and now I get a different error as below Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\scripts\email.php on line 25 Copied in the php.ini mail function and also the sendmail.ini. [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = mail.crltd.co.uk ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = paul@crltd.co.uk ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path ;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename mail.add_x_header = Off ; Log all mail() calls including the full path of the script, line #, to address and headers ;mail.log = "C:\xampp\php\logs\php_mail.log" ; http://php.net/sql.safe-modesql.safe_mode = Off sendmail.ini ; if your smtp server requires authentication, modify the following two lines;auth_username=paul@crltd.co.uk;auth_password=password; if your smtp server uses pop3 before smtp authentication, modify the; following three lines;pop3_server=mail.crltd.co.uk;pop3_username=paul@crltd.co.uk;pop3_password=password; to force the sender to always be the following email address, uncomment and; populate with a valid email address. this will only affect the "MAIL FROM"; command, it won't modify the "From: " header of the message content;force_sender=me@localhost; sendmail will use your hostname and your default_domain in the ehlo/helo; smtp greeting. you can manually set the ehlo/helo name if required;hostname=localhost Link to comment Share on other sites More sharing options...
Larry Posted August 22, 2012 Share Posted August 22, 2012 Quote your string values in the ini file. Link to comment Share on other sites More sharing options...
Paul_Blackpool Posted August 22, 2012 Author Share Posted August 22, 2012 Larry excuse my ignorance but, how do I do that? Link to comment Share on other sites More sharing options...
Larry Posted August 22, 2012 Share Posted August 22, 2012 sendmail_from = "paul@crltd.co.uk" That may not solve the problem, but it's the first thing I'd do (for all your string values). Link to comment Share on other sites More sharing options...
Recommended Posts