コード例 #1
0
ファイル: sendEmail.php プロジェクト: cjbayliss/alloc
    $person = new person();
    $person->read_db_record($db);
    $person->set_id($db->f("personID"));
    $person->load_prefs();
    if (!$person->prefs["dailyTaskEmail"]) {
        continue;
    }
    $msg = "";
    $tasks = "";
    $to = "";
    if ($announcement["heading"]) {
        $msg .= $announcement["heading"];
        $msg .= "\n" . $announcement["body"] . "\n";
        $msg .= "\n- - - - - - - - - -\n";
    }
    if ($person->get_value("emailAddress")) {
        $tasks = $person->get_tasks_for_email();
        $msg .= $tasks;
        $subject = commentTemplate::populate_string(config::get_config_item("emailSubject_dailyDigest", ""));
        $to = $person->get_value("emailAddress");
        if ($person->get_value("firstName") && $person->get_value("surname") && $to) {
            $to = $person->get_value("firstName") . " " . $person->get_value("surname") . " <" . $to . ">";
        }
        if ($tasks && $to) {
            $email = new email_send($to, $subject, $msg, "daily_digest");
            if ($email->send()) {
                echo "\n<br>Sent email to: " . $to;
            }
        }
    }
}