Welcome Guest, Not a member yet? Register   Sign In
how do you do a newsletter (batches)
#6

[eluser]n0xie[/eluser]
indeed use cron:

Code:
function sendqueue()
{
$where = "blnSend='0' AND datPlanned <= '".date('Y-m-d')."'";
$this->db->where($where,'',FALSE);
$this->db->limit(5);
$list = $this->db->get('tblemail')->result();

        foreach ($list as $email)
        {
            $this->email->clear();

            $this->email->to($email->to);
            $this->email->from($email->from);
            $this->email->subject($email->subject);
            $this->email->message($email->message);
            
            if($this->email->send())
            {
                $this->db->set('blnSend',1);
                $this->db->set('datSend',date('Y-m-d'));
                $this->db->where('ID_Email', $email->ID_Email);
                $this->db->update('tblemail');
            }
            else
            {
                $this->db->set('blnSend',0);
                $this->db->set('blnError',1);
                $this->db->set('msgError',$this->email->print_debugger());
                $this->db->where('ID_Email', $email->ID_Email);
                $this->db->update('tblemail');
            }
        }
    }
}


Messages In This Thread
how do you do a newsletter (batches) - by El Forum - 07-11-2009, 09:36 PM
how do you do a newsletter (batches) - by El Forum - 07-11-2009, 10:20 PM
how do you do a newsletter (batches) - by El Forum - 07-11-2009, 10:53 PM
how do you do a newsletter (batches) - by El Forum - 10-05-2009, 08:35 AM
how do you do a newsletter (batches) - by El Forum - 10-05-2009, 08:40 AM
how do you do a newsletter (batches) - by El Forum - 10-05-2009, 08:49 AM
how do you do a newsletter (batches) - by El Forum - 10-05-2009, 09:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB