FAQ Item

« Return to FAQ database

Out of memory errors / system wont send emails

Try editing the file /php/class.newsletter.php

Search for the "public function get_send" part about half way through the file.
Replace that entire block of code with this new one:

public function get_send($db,$send_id){
if(!$db)$db = db_connect();
$sql = "SELECT * FROM `"._DB_PREFIX."send` WHERE `send_id` = '".(int)($send_id)."'";
$send = array_shift(qa($sql,$db));
$sql = "SELECT nm.member_id FROM `"._DB_PREFIX."newsletter_member` nm LEFT JOIN `"._DB_PREFIX."member` m USING (member_id) WHERE nm.send_id = '".(int)($send_id)."' AND nm.status = 1 AND m.unsubscribe_date = '0000-00-00'";
$send['unsent_members'] = qa($sql,$db);
$sql = "SELECT nm.member_id FROM `"._DB_PREFIX."newsletter_member` nm LEFT JOIN `"._DB_PREFIX."member` m USING (member_id) WHERE nm.send_id = '".(int)($send_id)."' AND nm.status != 1";
$send['sent_members'] = qa($sql,$db);
$sql = "SELECT nm.member_id FROM `"._DB_PREFIX."newsletter_member` nm LEFT JOIN `"._DB_PREFIX."member` m USING (member_id) WHERE nm.send_id = '".(int)($send_id)."' AND m.unsubscribe_date != '0000-00-00' AND m.unsubscribe_send_id = '".mysql_real_escape_string($send_id)."'";
$send['unsub_members'] = qa($sql,$db);
$sql = "SELECT nm.member_id FROM `"._DB_PREFIX."newsletter_member` nm LEFT JOIN `"._DB_PREFIX."member` m USING (member_id) WHERE nm.send_id = '".(int)($send_id)."' AND nm.open_time > 0";
$send['opened_members'] = qa($sql,$db);
$sql = "SELECT nm.member_id FROM `"._DB_PREFIX."newsletter_member` nm LEFT JOIN `"._DB_PREFIX."member` m USING (member_id) WHERE nm.send_id = '".(int)($send_id)."' AND nm.bounce_time > 0";
$send['bounce_members'] = qa($sql,$db);
return $send;
}