logger = $logger; } /** * Send the given Message. * * Recipient/sender data will be retrieved from the Message API. * The return value is the number of recipients * * @param SimpleMessage $message * @param string[] $failedRecipients An array of failures by-reference * * @return int */ public function send( SimpleMessage $message, &$failedRecipients = null ): int { $this->logger->debug( 'Mail: Send mail "{title}" to "{recipients}":' . PHP_EOL . PHP_EOL . '{content}', [ 'title' => $message->getSubject(), 'recipients' => $this->getTo($message), 'content' => $message->toString(), ] ); return count($this->allRecipients($message)); } }