示例#1
0
 /**
  * Send batched mail to mailer
  *
  * @param array $resetEmailTypes Array of email types to clear after flusing the queue
  *
  * @return bool
  */
 public function flushQueue($resetEmailTypes = array('To', 'Cc', 'Bcc'))
 {
     if ($this->tokenizationEnabled) {
         $to = $this->message->getTo();
         if (!empty($to)) {
             $result = $this->send(false, true);
             // Clear queued to recipients
             $this->queuedRecipients = array();
             foreach ($resetEmailTypes as $type) {
                 $type = ucfirst($type);
                 $headers = $this->message->getHeaders();
                 if ($headers->has($type)) {
                     $this->message->getHeaders()->remove($type);
                 }
             }
             // Clear metadat for the previous recipients
             $this->message->clearMetadata();
             return $result;
         }
         return false;
     }
     // Batching was not enabled and thus sent with queue()
     return true;
 }