Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/56710-feedback-form/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/56710-feedback-form/#findComment-280240
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.