PHP邮件问题,无法发送

PHP邮件问题,无法发送,php,function,email,Php,Function,Email,我目前在我的网站上使用反馈表单,我正在尝试将反馈表单发送到我的电子邮件中,但不断收到通知,也许有人可以给我发送正确的方式来编写它。非常感谢这里是我的所有代码和错误 形式 试一试 您想设置一个起始标题。。。正如错误所说 mail ("spencer.schell87@gmail.com","Widget Box Contact Form","$body","FROM: $email"); mail ("$email","Widget Box Contact Form","$body","FROM:

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

形式

试一试


您想设置一个起始标题。。。正如错误所说

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

请注意内置PHP邮件函数的限制。您很可能会遇到交付问题,因为许多SMTP服务器配置为拒绝具有不正确设置的邮件头的电子邮件。我会像PHPmailer一样查找一个为您处理此问题的库。警告:mail()[function.mail]:无法在“localhost”端口25连接到mailserver,请验证php.ini中的“SMTP”和“SMTP\u port”设置,或者在第24行的C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php中使用ini\u set()[function.mail]:无法在“localhost”端口25连接到mailserver,请验证php.ini中的“SMTP”和“SMTP_端口”设置或使用ini_set()在第25行的C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php中,修复了第一部分,但这可能是因为我使用的是xampp还是什么,如果我上传到我的站点,它会工作吗?否…xampp不包括服务器邮件。你必须安装另一个服务。在你的服务器上,你不会有问题。
//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
mail ("spencer.schell87@gmail.com","Widget Box Contact Form","$body","From: $email");
mail ("$email","Widget Box Contact Form","$body","From: spencer.schell87@gmail.com");
mail ("spencer.schell87@gmail.com","Widget Box Contact Form","$body","FROM: $email");
mail ("$email","Widget Box Contact Form","$body","FROM: spencer.schell87@gmail.com");