我给大约2560封电子邮件发了一份时事通讯。php脚本为表中的每封电子邮件创建一个条目,每15分钟发送50封邮件,这样服务器就不会忙了。
当我把时事通讯发给所有2560封电子邮件时,我得到了404页。当我只选择我的电子邮件时,一切都顺其自然。我认为mysql添加这么多条目是有限制的。我可以添加任何超过994封电子邮件,我得到404错误。我如何解决这个问题?
我从左列表中选择用户>单击右箭头>将用户移动到右列表,然后当我按submit时,所有用户都被选中(从“发送到”列表),并收到404错误(超过994时)或成功消息。
$conn = sfContext::getInstance()->getDatabaseManager()->getDatabase('doctrine')->getDoctrineConnection();
ini_set('memory_limit', '1024M');
set_time_limit(0);
try
{
$conn->beginTransaction();
foreach ($to as $email => $name)
{
if (is_integer($email))
{
$email = $name;
}
$hash = substr(md5($email), 0, 5);
//save to cron job
$html = str_replace(array('[+hash+]', '[+email+]'),array($hash, $email), $content);
$query = $conn->prepare($sql = "INSERT INTO CronEmail (sendto_name, sendto_email, from_name, from_email, subject, message, created_at)
VALUES (:sendto_name, :sendto_email, :from_name, :from_email, :subject, :message, :created_at);");
$query->execute(
array('sendto_name' => $name,
'sendto_email' => $email,
'from_name' => "Newsletter " . $fromsite,
'from_email' => "newsletter@office.ro",
'subject' => $newsletter->getSubject(),
'message' => $html,
'created_at' => date('Y-m-d H:i:s'))
);
}
$conn->commit();
}catch (Doctrine_Exception $e) { // Rollback if transaction fail
$conn->rollback();
echo $sql;
echo $e->getMessage();
die();
}
$this->getUser()->setFlash('alert', '<div class="alert_ok">Newsletterul a fost salvat si va fi trimis!</div>');
$this->redirect('newsletter_send/index');
}
}
暂无答案!
目前还没有任何答案,快来回答吧!