我能';我不能让xampp或远程服务器使用我的php邮件功能发送电子邮件

我能';我不能让xampp或远程服务器使用我的php邮件功能发送电子邮件,php,apache,email,Php,Apache,Email,我已经在我的计算机上安装了xampp用于一个学校项目,我还可以访问学校的apache服务器,在那里我可以上传文件并运行它们 <?php $headers.= 'MIME-Version: 1.0' . "\r\n"; $headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $rating=$_POST['Rating']; $subject= "review from website"; $name=$_POST

我已经在我的计算机上安装了xampp用于一个学校项目,我还可以访问学校的apache服务器,在那里我可以上传文件并运行它们

<?php
$headers.= 'MIME-Version: 1.0' . "\r\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$rating=$_POST['Rating'];
$subject= "review from website";
$name=$_POST['lname'].", ".$_POST['name'];
$from = $_POST['email'];
$to ="bricebathel@hotmail.com; bbathel@pembaserv.com;".$from.";";
$messageTo="BBComputers";
$headers = "From:" . $from;
$message = htmlspecialchars($_POST['comment']);
$about = $_POST['product'];
$date=date("j-n-y \a\\t g:ia\n");
mail($to,$subject,$message,$headers);
echo "<p id='contactUsData'>Message Sent to: ".$messageTo."<br>Date: ".$date."<br>                       From: ".$name."<br> About: ".$about."<br> Rating: ".$rating."<br> Message:".$message."<//p>";


$file_message="From: ".$name."\nEmail: ".$from."\nAbout: ".$subject."\nRating:   ".$rating."\nMessage: ".$message;
$file= fopen("data/feedback.txt","a")
    or die("Error: Could not open the log file.");
fwrite($file,"\n----------------------------\n")
    or die("Error: Could not open the log file.");
fwrite($file,"Received: ".$date."\n")
    or die("Error: Could not open the log file.");
fwrite($file,$file_message)
    or die("Error: Could not open the log file.");
?>

如果您还没有smtp服务器来发送邮件,则必须设置smtp服务器。然后您需要编辑php配置文件以指向该服务器

您需要一个smtp服务器来发送电子邮件。您可以设置sendgrid帐户,然后使用sendgrid类发送电子邮件。api文档非常好

其他供应商也有,他们通常每天免费给你发200封邮件。如果这是一个学校项目,那么你可以不受配额限制

如果您需要发送更多信息,您可能需要考虑设置smpt服务器。或者付钱