/** * process number of messages in queue * * @param integer $_numberOfMessagesToProcess */ public function processQueue($_numberOfMessagesToProcess = 5) { if ($this->_queue && count($this->_queue) > 0) { $numberToProcess = min(array($_numberOfMessagesToProcess, count($this->_queue))); Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' processing messages: ' . $numberToProcess . ' of ' . count($this->_queue)); $messages = $this->_queue->receive($numberToProcess); foreach ($messages as $i => $message) { $this->_executeAction($message->body); $this->_queue->deleteMessage($message); } } }
//send_webmail($to_email,$subject,$mailcontent,$callback); if (!empty($msg)) { $flag = 0; //failed $result = "发送失败" . $msg; $successrate = 0; } else { $flag = 1; //success $result = "发送成功"; $successrate = 1; } //保存单条邮件记录 saveMailLog($sjid, $maillogsid, $receiver, $to_email, $subject, $mailcontent, $flag, $result, $successrate, $userid); //删除该条Message $queue->deleteMessage($message); //暂停几秒 if (empty($interval)) { $interval = 5; } sleep($interval); } function send_webmail($to_email, $receiver, $from_name, $from_email, $subject, $contents, $maillogsid, $userid) { global $adb; // 实例化mail //if(empty($from_email)){ $query = "select * from ec_systems where server_type='email' and smownerid='" . $userid . "' order by id"; // }else{ // $query = "select * from ec_systems where server_type='email' and from_email = '".$from_email."' "; // }