我无法让xampp或远程服务器发送带有我的php邮件功能的电子邮件

时间:2022-02-25 18:15:28

I have installed xampp on my computer for a school project, and I also have access to an apache server at school where I can upload my files and run them.

我已经在我的计算机上安装了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.");
?>

I can't get it to send the mail from either xampp or the apache server

我无法从xampp或apache服务器发送邮件

2 个解决方案

#1


0  

You need an smtp server to send an email. You could set up a sendgrid account and then use the sendgrid class to send out an email. the api docs are very good.

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

http://sendgrid.com/docs/

Other vendors are available, they normally give you about 200 email outs a day for free. If this is a school project, then you could get away with that quota.

其他供应商可用,他们通常每天免费为您提供大约200封电子邮件。如果这是一个学校项目,那么你可以逃脱该配额。

If you need to send out a few more you might have to look into setting up an smpt server. Or pay.

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

#2


0  

You have to setup an smtp server if you don't already have one to send the mail. Then you need to edit the php config files to point to that server

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

#1


0  

You need an smtp server to send an email. You could set up a sendgrid account and then use the sendgrid class to send out an email. the api docs are very good.

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

http://sendgrid.com/docs/

Other vendors are available, they normally give you about 200 email outs a day for free. If this is a school project, then you could get away with that quota.

其他供应商可用,他们通常每天免费为您提供大约200封电子邮件。如果这是一个学校项目,那么你可以逃脱该配额。

If you need to send out a few more you might have to look into setting up an smpt server. Or pay.

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

#2


0  

You have to setup an smtp server if you don't already have one to send the mail. Then you need to edit the php config files to point to that server

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