bflosabre91 Posted June 22, 2007 Share Posted June 22, 2007 I'm trying to create a simple email form where it automatically sends a quick message a user inputs to a hardcoded email address. the form i use looks like this: <html> <div id="body"> <form method="post" action="sendmail.php"> <table id="emailform"> <tr> <td>First Name: </td> <td><input name="firstName" type="text"/></td> </tr> <tr> <td>Last Name: </td> <td><input name="lastName" type="text"/></td> </tr> <tr> <td>Email: </td> <td><input name="email" type="text" /><br /></td> </tr> <tr> <td valign="top">Message:</td> <td><textarea name="message" rows="10" cols="40"> </textarea> <br /> <input type="submit" /></td> </tr> </table> </form> </div><!--ending div id= body--> </html> and the actual mail sending code is this: <?php /*Here we are going to declare the variables*/ $firstName = $_POST['firstName']; $lasName = $_POST['lastName']; $email = $_POST['email']; $message = $_POST['message']; //Save visitor name and entered message into one variable: $formcontent="VISITOR NAME: $firstName\n$lastName\nFEEDBACK: $message"; $recipient = "bflosabre91@yahoo.com"; $subject = "Contact Form"; $mailheader = "From: $email\r\n"; $mailheader .= "Reply-To: $email\r\n"; $mailheader .= "MIME-Version: 1.0\r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Failure!"); echo "Thank You!"; ?> and this is the error i get "Failure!PHP 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() in D:\Template\sendmail.php on line 13" Any help I would really appreciate. Thanks Colby Quote Link to comment https://forums.phpfreaks.com/topic/56710-feedback-form/ Share on other sites More sharing options...
pikemsu28 Posted June 22, 2007 Share Posted June 22, 2007 you need to setup your mail server in your php.ini file [mail function] ; For Win32 only. SMTP = {address of mail server} smtp_port = 25 currently it appears to be set to 'localhost' Quote Link to comment https://forums.phpfreaks.com/topic/56710-feedback-form/#findComment-280094 Share on other sites More sharing options...
bflosabre91 Posted June 22, 2007 Author Share Posted June 22, 2007 thanks, i fixed the php.ini file now and it sends the email where it should be but it takes a long time and displays this error PHP Fatal error: Maximum execution time of 30 seconds exceeded in D:\Template\sendmail.php on line 14 i dont understand it because the mail that was sent is exactly what it should be but it still displays this error. thanks colby Quote Link to comment https://forums.phpfreaks.com/topic/56710-feedback-form/#findComment-280240 Share on other sites More sharing options...
bflosabre91 Posted June 22, 2007 Author Share Posted June 22, 2007 im an idiot, had to restart the server and all is well. just a fyi Quote Link to comment https://forums.phpfreaks.com/topic/56710-feedback-form/#findComment-280492 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.