Esempio n. 1
0
 /**
  * Send a bulk message to all users, limited only by message criteria.
  *
  * @param integer $message_id
  *   The ID of the message.
  * @param boolean $test
  *   Whether to just sent a test message.
  * @param boolean $auto
  *   Whether this is called as an automatic mailer.
  *
  * @return integer
  *   The number of users the message was sent to.
  */
 function sendBulk($message_id, $test = false, $auto = false)
 {
     $this->message = new Message($message_id, true, $auto);
     $this->from(Configuration::get('mailer.mail_from') ?: Configuration::get('site.mail_from'), Configuration::get('mailer.mail_from_name') ?: Configuration::get('site.mail_from_name'));
     if ($test) {
         $this->message->setTest(true);
         $this->loadTestUsers();
     } else {
         $this->users = $this->message->getUsers();
     }
     if ($this->verbose) {
         echo 'Sending ' . ($test ? 'Test' : 'Real') . " Email ";
     }
     $this->sendToList();
     if ($this->verbose) {
         echo ($test ? 'Test' : 'Mailing') . ' complete';
     }
     return $this->sentCount;
 }