function mail($verbose = 0) { $timestamp = strtotime('+1 day'); $this->date = date('Y-m-d', $timestamp); if (!$this->load_schedule()) { return false; } global $db; $select = "CONCAT(first_name,' ',last_name) as name, mail\r\n FROM person\r\n WHERE opt&32=32"; $db->select($select); $recipients = $db->data; $mail = new mail(); $subject_v['date'] = local_date($this->date); $subject = new tmpl('mail_subject.txt', $subject_v); $mail->set_subject($subject->fdata); $mail->data_main = $this->text; $output = ''; foreach ($recipients as $i => $person) { $name = $person['name']; $mail->sendto($person['mail'], $name); if ($mail->sent) { $output .= '_'; } else { $output .= 'X'; } } if ($verbose) { echo $output; } return $output; }