/** * Send the current message to the current list of users. */ protected function sendToList() { $this->sentCount = 0; foreach ($this->users as $user) { if ($this->verbose && $this->sentCount % 100 == 0) { set_time_limit(60); echo '. '; } // Send message. $this->to($user['email'], $user['first'] . ' ' . $user['last']); $from = !empty($user['from']) ? $user['from'] : $this->from; $from_name = !empty($user['from_name']) ? $user['from_name'] : $this->fromName; $this->from($from, $from_name); $this->message->setUser(new User($user)); $this->message->setDefaultVars(); $this->subject($this->message->getSubject()); $this->message($this->message->getMessage()); if ($this->sendMessage()) { $this->sentCount++; } $this->mailer->ClearAddresses(); Tracker::trackEvent('Email Sent', $this->message->id, !empty($user['user_id']) ? $user['user_id'] : 0); } echo "\n\n"; }
/** * Get a count of how many emails to be sent with output for XHR monitoring. */ public function postSendCount() { Messenger::setVerbose(true); $message = new Message(Request::get('id', 'int')); echo 'Sending now will go to ' . $message->getUsersCount() . ' users.'; exit; }