/** * 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); $this->message->{"set" . $type}(array()); } // Clear metadata for the previous recipients $this->message->clearMetadata(); return $result; } return false; } // Batching was not enabled and thus sent with queue() return true; }