0

我目前正在我的网站上使用反馈表,我正在尝试将该反馈表发送到我的电子邮件,但不断收到通知,也许有人可以向我发送正确的编写方式,非常感谢这里是我所有的代码和错误..

形式

    <script type="text/javascript">
    function MM_validateForm() { //v4.0
      if (document.getElementById){
        var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
        for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
          if (val) { nm=val.name; if ((val=val.value)!="") {
            if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
              if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
            } else if (test!='R') { num = parseFloat(val);
              if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
              if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
                min=test.substring(8,p); max=test.substring(p+1);
                if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
          } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
        } if (errors) alert('The following error(s) occurred:\n'+errors);
        document.MM_returnValue = (errors == '');
    } }
    </script>
            <div id="services">
              <h3><a href="services.php">Services</a></h3>
              <p>What we can do</p>
              <ul>
               <li>item</li>
               <li>item</li>
               <li>item</li>
               <li>item</li>
              </ul>
              </div>
            <div id="portfolio">
              <h3><a href="portfolio.php">Portfolio</a></h3>
                 <p>Some of our work</p>
            </div>
            <div id="hireus">
          <h3><a href="services.php">Request more info below!</a></h3>
          <form action="processor.php" method="post" name="myform" id="myform" onsubmit="MM_validateForm('fname','','R','lname','','R','email','','RisEmail','phone','','NisNum');return document.MM_returnValue">
        <label for="fname">First name</label>
        <input name="fname" type="text" id="fname" />
        <label for="lname">Last name</label>
        <input name="lname" type="text" id="lname" />
        <label for="email">Email Address</label>
        <input name="email" type="text" id="email" />
        <label for="phone">Phone Number</label>
        <input name="phone" type="text" id="phone" placeholder="800.867.5309" />
        <fieldset class="checkgroup">
        <legend>Services Interested In:</legend>
        <input name="services" type="checkbox" value="services_web" id="services_web" />
        <label for="services_web">Web Design</label>
         <input name="services" type="checkbox" value="services_design" id="services_design" />
        <label for="services_web">Video & 3D</label>
         <input name="services" type="checkbox" value="services_consultation" id="services_consultation" />
        <label for="services_web">Consulation</label>
        </fieldset>
        <textarea name="comments" id="comments" cols="35" rows="3"></textarea>
        <input name="submit" type="submit" value="Submit Info" />
        </form>

              </div>

 PROCESSOR 



<?php
/************************

*PHP 表单处理器 * * ** * ** * ** * *** /

//Trim removes white space after strip_tags gets rid of any html, javascript, etc tags from the input
$fname = trim(strip_tags($_POST['fname']));
$lname = trim(strip_tags($_POST['lname']));
$email = trim(strip_tags($_POST['email']));
$phone = trim(strip_tags($_POST['phone']));
$services = trim(strip_tags($_POST['services']));
$comments = trim(strip_tags($_POST['comments']));

//Creating a single variable to format and hold all the inputs
$body = "
Website Contact Form
First Name: $fname
Last Name: $lname
Email Address: $email
Phone: $phone
Services Interested In: $services
Comments: $comments";

mail ("spencer.schell87@gmail.com","Widget Box Contact Form","$body","$email");
mail ("$email","Widget Box Contact Form","$body","spencer.schell87@gmail.com");

?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/formatBlog.css" />
<title>Schell Shock Design's Portfolio</title>
</head>

<body class="tos">
  <div id="login">
   <?php include('login.php'); ?>
</div>
  </div>
  <div id="utilities">
   <?php include('utilities.php'); ?>
  </div>
<div id="container">
  <header>
    <?php include('header.php'); ?>
   </header>
 <div id="formsuccess">
            <h3>Thank You!</h3>
    <?php
//if the email was sent, show the success message
    echo '<div class="success">Thanks '.$fname.'. Your message was sent.</div>';
        echo '<div class="success">A copy of your form results were also mailed to '.$email.'.</div>';
    echo '<div class="success">We will get back to you at: '.$email.' or at: '.$phone.' within 24 hours.</div>';
?>

          </div>
  <div id="footer">
    <?php include('footer.php'); ?>
         </div>
</div>
</body>
</html>

我的警告:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php on line 24

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php on line 25
4

2 回答 2

1

尝试

mail ("spencer.schell87@gmail.com","Widget Box Contact Form","$body","From: $email");
mail ("$email","Widget Box Contact Form","$body","From: spencer.schell87@gmail.com");
于 2012-07-07T18:49:46.323 回答
0

您想设置一个 FROM Header... 如错误所示

mail ("spencer.schell87@gmail.com","Widget Box Contact Form","$body","FROM: $email");
mail ("$email","Widget Box Contact Form","$body","FROM: spencer.schell87@gmail.com");
于 2012-07-07T18:49:55.027 回答