[eluser]Michael Wales[/eluser]
Code:
$this->load->database();
$this->load->library('email');
$this->email->from('if_you_use_this_to_spam_me@i_will_kill_you.com');
$this->email->subject('I am serious');
$this->email->message('You will be a dead man.');
$query = $this->db->getwhere('addresses', array('mailsent'=>'N'), 50, 0);
if ($query->numrows() != 0) {
foreach ($query->result() as $address) {
$this->email->to($address->email);
$this->email->send();
$this->db->update('addresses', array('mailsent'=>'Y'), array('email'=>$email));
}
}