우리 콘텐트 사용자가 뉴스 레터를 배포 목록에 보내도록 빠르고 쓴 스크립트를 작성했습니다. 이 스크립트는 몇 달 동안 잘 작동하므로 PEAR 메일러로 다시 작성하는 것이 내 우선 순위 목록에서 부족합니다. 오늘 스크립트는 이메일을 발송하지 못했습니다. mail() 함수는 false를 반환하고 전자 메일은 전달되지 않지만 error_get_last()는 null입니다. 스크립트가 갑자기 작동하지 않는 이유를 알아 내기 위해 무엇을 할 수 있습니까? 미리 감사드립니다.PHP mail()은 false를 반환하지만 오류는 기록되지 않습니다.
<?php
ob_start();
readfile("/html-email/tt-facstaff");
$facstaff_content = utf8_decode(ob_get_contents());
ob_start();
readfile("/html-email/tt-students");
$students_content = utf8_decode(ob_get_contents());
ob_end_clean();
ob_end_clean();
if($students_content === false || $facstaff_content === false) die("<h4>Failed to decode content.</h4>");
$all_content = $facstaff_content."\n\n".$students_content;
if(isset($_GET["go"]) && $_GET["go"] == "true"){
$ppl = "redacted";
$students = "redacted";
$facstaff = "redacted";
$subject = "Tech Times for ".date("m/d");
$headers = "From: \"Tennessee Tech University\" <redacted>\r\n".
"Reply-to: redacted\r\n".
"MIME-Version: 1.0\r\n".
"Content-type: text/html; charset=iso-8859-1\r\n".
"X-Mailer: PHP/".phpversion();
$ok1 = mail($students,$subject,$students_content,$headers."\r\nBcc:".$ppl);
$ok2 = mail($facstaff,$subject,$facstaff_content,$headers);
if($ok1 && $ok2){
echo("<html><body><div><h1 style=\"width:800px; margin:40px auto; text-align:center;\">Tech Times has been sent.</h1></div></body></html>");
}else{
$error = error_get_last();
var_dump($error);
echo("<html><body><div><h2 style=\"width:800px; margin:40px auto; text-align:center; color:#FF0000;\">Failed to send one or both editions of Tech Times!</h2></div></body></html>");
}
}
echo $all_content;
echo("<html><body><div style=\"width:800px; margin:40px auto; text-align:center;\"><a href=\"/html-email/tech-times?go=true\">Send Tech Times</a></div></body></html>");
?>
PHP 오류가 없으므로 PHP 오류 덤프를 찾지 마십시오. 서버에 메일 로그 액세스 권한이 있습니까? – sglessard
서버가 그렇게 할 수없는 것처럼 보입니다, Dave. –