이 코드를 사용하여 내 서버를 사용하여 내 목록으로 전자 메일을 보내고 있습니다. 잠시 후 내 이메일 목록이 크기 때문에 스크립트에 시간 초과가 발생합니다.PHP 스크립트가 시간 초과없이
이 문제를 해결할 수 있습니까?
다른 점은 서버에 과부하를 걸지 않기를 바랍니다. 각 줄 사이에 각 전자 메일을로드하기 위해 스크립트에 추가 할 수있는 코드가 있습니까? 여기
메일 화재 후 내가<?php
$emailaddress = file("email-list.txt"); // load from a flat file, assuming 1 email per line in the file
$emailsubject = "[title] title of my email";
$emailbody = file_get_contents("email-content.html");
$fromaddress = "[email protected]";
$i = count($emailaddress);
$z = 0;
// here we check how many email address's we have, if its is 0, then we don't start the email function
if ($i != 0)
{// start if
// Lets loop until we reach the count from email address arrar
while ($i != $z)
{// start while
// here we send the email to the varables from above, using the email array incrament
mail($emailaddress[$z], $emailsubject, $emailbody, "From: " .$fromaddress. "\nX-Mailer: PHP 4.x");
// lets echo out that the email was sent
echo $z + 1 . " out of " . $i . " emails sent. (" . $emailaddress[$z] . ")<br>";
// increment the array one, so we get a new email address from the array
++$z;
}// end while
}//end if
else
{//start else
// we echo out that no emails where found in the array and end the script
echo "Warning: No emails in array.";
}// end else
?>
가있다 스크립트가 명령 줄에서 실행 되었습니까? – Fabricator