} $res = $db->query($query); if ($res instanceof PEAR_Error) { $cli->fatal($res); } $cli->message($res->numRows(), 'cli.success'); $subject = sprintf('News on %s', $registry->get('name', 'horde')); $body = "Hello %s,\n\n There is someting new on %s\n\n. Visit us at %s"; // Prepare data for bash process or delete one by one $paths = array(); while ($row =& $res->fetchRow()) { $body2 = sprintf($body, $row[0], $registry->get('name', 'horde'), Folks::getUrlFor('user', $row[0], true, -1)); // Send mail $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], 'UTF-8'); $mail->addHeader('User-Agent', 'Folks' . $registry->getVersion()); $sent = $mail->send($conf['mailer']['type'], $conf['mailer']['params']); if ($sent instanceof PEAR_Error) { $cli->message($sent, 'cli.warning'); } else { $cli->message($row[0], 'cli.success'); } // sleep(1); } $cli->message('done', 'cli.success'); /** * Show the command line arguments that the script accepts. */ function showHelp() { global $cli; $cli->writeln(sprintf(_("Usage: %s [OPTIONS]..."), basename(__FILE__)));