我已经在学校项目的计算机上安装了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 ="[email protected]; [email protected];".$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.");
?>
我无法从xampp或apache服务器发送邮件
您需要一个smtp服务器才能发送电子邮件。您可以设置一个sendgrid帐户,然后使用sendgrid类发送电子邮件。api文档非常好。
还可以使用其他供应商,它们通常每天免费为您提供200封电子邮件。如果这是一个学校项目,那么您可以免除该配额。
如果您需要发送更多信息,则可能必须考虑设置smpt服务器。或付钱。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句