如何修复“500 - 内部服务器错误”。用PHP发送简报

时间:2015-03-17 14:49:24

标签: php newsletter

我正在尝试用PHP制作新闻稿。 我有数据库,其中有超过3000个电子邮件条目。

当我在服务器上执行代码时,它会显示服务器错误,如:

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

这是我的代码:

<?php
include_once "../connect_to_mysql.php";
$sql = mysql_query("SELECT * FROM newsletter");
$numRows = mysql_num_rows($sql);
$mail_body = '';
set_time_limit(0);
ini_set('max_execution_time', 0);
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$email = $row["email"];
$name = $row["name"]; 

$mail_body = '.... SOME HMTL CODE.....';

$subject = "Anything & Everything Magazine Newsletter";
$headers  = "From:hello@cykotech.com\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$email";

$mail_result = mail($to, $subject, $mail_body, $headers);

if ($mail_result) {
    mysql_query("UPDATE newsletter SET received='1' WHERE email='$email' LIMIT 1");
}

}
?>

请帮助,提前致谢。

0 个答案:

没有答案