Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP邮件不工作。困惑的_Php_Email - Fatal编程技术网

PHP邮件不工作。困惑的

PHP邮件不工作。困惑的,php,email,Php,Email,下面是解析代码 error_reporting(E_ALL); ini_set('display_errors', '1'); $formbtn = $_POST['formbtn']; $emails = $_POST['emails']; if(isset($formbtn)){ $to = "xxxxxxx@xxxxx.com"; $subject = $_POST["subject"]; $body = nl2br($_POST["message"]); $b

下面是解析代码

error_reporting(E_ALL);

ini_set('display_errors', '1');



$formbtn = $_POST['formbtn'];

$emails = $_POST['emails'];



if(isset($formbtn)){



$to = "xxxxxxx@xxxxx.com";

$subject = $_POST["subject"];

$body = nl2br($_POST["message"]);

$body .= "<br /><br /><br />If you wish to unsubscribe from these emails you must contact shiv via the alliance forums, clan chat, the supercell forums or by replying to this email.";

$headers  = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= 'Reply-To: xxxxxxxx@xxxxxxxx.xxxx' . "\r\n";

$headers .= "BCC: " . $emails . "\r";



if(mail($to, $subject, $body, $headers, "-fadmin@forumalliance.hol.es") ){

echo "Mail Sent!";

}
else
    echo "Mail not sent!";



}else{

    echo "Invalid form submission.";
表单按预期工作,我能够回显变量:$emails、$formbtn、$body、$subject

当我发送邮件时,我收到的是未发送的邮件


知道为什么会发生这种情况吗?

您的服务器类型是什么??? 如果是localhost,您应该配置邮件服务

如果是服务器,则有2种情况:

它是共享主机。 它是vps或专用服务器。 1: 一些服务器限制他们的邮件功能,这是为了他们的安全问题等等。您可以要求服务提供商释放此功能的访问权限。他们决定拒绝或同意

2:
如果是vps或专用服务器,请联系您的服务器管理人员,告诉他/她您的邮件功能不工作,他们会尽快解决此问题。

ifisset$formbtn没有结束标记{?您使用什么进行测试?托管、您的本地主机或…?看起来服务器未正确配置为从PHP发送电子邮件。