php中的mail函数

php中的mail函数,php,Php,调试有时会很忙。。。如何处理邮件功能?似乎我需要更改一些设置,但我不知道如何处理它们:当我试图在论坛上发布回复时,出现了以下错误: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\mysit

调试有时会很忙。。。如何处理邮件功能?似乎我需要更改一些设置,但我不知道如何处理它们:当我试图在论坛上发布回复时,出现了以下错误:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\mysite\forum part two\post_reply_parse.php on line 72
我在第72行的代码是

mail($to, $subject, $message, $headers);
我的邮政编码是这样的

$email = '';
        $email = substr($email, 0, (strlen($email) - 2));
        address with your domain at the end
        $to = "";
        $from = "";
        // $bcc is the list of emails that will be sent out as blind carbon copies
        $bcc = $email;
        $subject = "YOUR_SUBJECT_HERE";


        $message = "YOU MESSAGE CONTENT HERE";

        $headers = "From: $from\r\nReply-To: $from";
        $headers .= "\r\nBcc: {$bcc}";
        // Send out the email
        mail($to, $subject, $message, $headers);
我不想忽视这个错误,我想学习如何修复它

默认情况下,PHP将在Linux/Unix机器上使用sendmail,因为它是一种普遍可用的邮件服务

另一方面,Windows并没有附带一个。为了在Windows计算机上使用邮件,您需要安装本地SMTP服务器或将PHP安装配置为通过另一个SMTP服务器中继邮件

注意:我个人没有使用过sendmail,因为我倾向于在Linux/Unix机器上进行开发,但这可能适合您:

PHP默认情况下将在Linux/Unix机器上使用sendmail,因为它是一种普遍可用的邮件服务

另一方面,Windows并没有附带一个。为了在Windows计算机上使用邮件,您需要安装本地SMTP服务器或将PHP安装配置为通过另一个SMTP服务器中继邮件


注意:我个人没有使用过,因为我倾向于在Linux/Unix机器上进行开发,但这可能适用于您:

未能在localhost连接到mailserver-是否有SMTP服务器在localhost上运行?否否,请让我查看有关如何配置它的教程未能在localhost连接到mailserver-是否有SMTP服务器在localhost上运行?否,请让我查看有关如何配置它的教程