From 4c38bdf9f3cb8fc19442c379776623920a95f074 Mon Sep 17 00:00:00 2001 From: Mr Ceperka Date: Wed, 29 Mar 2017 09:36:08 +0200 Subject: [PATCH] Update Mail.php --- src/Mail.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Mail.php b/src/Mail.php index c8ea518..5ab5f03 100644 --- a/src/Mail.php +++ b/src/Mail.php @@ -234,7 +234,18 @@ public function send() * In case mail sending in on, send message */ if ($this->config === self::CONFIG_BOTH || $this->config === self::CONFIG_SEND) { - $this->mailer->send($this->message); + try { + $this->mailer->send($this->message); + } catch (\Exception $e) { + /** + * In case mail logging is turned on, log failed email message + */ + if ($this->config === self::CONFIG_BOTH) { + $this->logger->log($this->log_type . '_failed', $this->message); + } + + throw $e; + } } /**