From 01e9c22695a3e495f07ab445750221af72e09fe4 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 5 Sep 2018 13:40:03 +0200 Subject: Implemented mailing abstraction Closes #434 --- src/Mail/Transport/LogTransport.php | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/Mail/Transport/LogTransport.php (limited to 'src/Mail/Transport/LogTransport.php') diff --git a/src/Mail/Transport/LogTransport.php b/src/Mail/Transport/LogTransport.php new file mode 100644 index 00000000..6e351302 --- /dev/null +++ b/src/Mail/Transport/LogTransport.php @@ -0,0 +1,44 @@ +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 . '{content}', + [ + 'title' => $message->getSubject(), + 'recipients' => $this->getTo($message), + 'content' => (string)$message->getHeaders() . PHP_EOL . PHP_EOL . $message->toString(), + ] + ); + + return count($this->allRecipients($message)); + } +} -- cgit v1.2.3-54-g00ecf