From 4d1ada5f28caa9e3344b2fff43e56fba0e9bcf0a Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 10 May 2016 15:40:23 +0900 Subject: [PATCH] Add mail.send (before/after) triggers --- common/framework/mail.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/common/framework/mail.php b/common/framework/mail.php index bd5980442..830638ede 100644 --- a/common/framework/mail.php +++ b/common/framework/mail.php @@ -534,15 +534,31 @@ class Mail */ public function send() { + $output = \ModuleHandler::triggerCall('mail.send', 'before', $this); + if(!$output->toBool()) + { + $this->errors[] = $output->getMessage(); + return false; + } + try { - return $this->driver->send($this); + $result = $this->driver->send($this); } catch(\Exception $e) { $this->errors[] = $e->getMessage(); + $result = false; + } + + $output = \ModuleHandler::triggerCall('mail.send', 'after', $this); + if(!$output->toBool()) + { + $this->errors[] = $output->getMessage(); return false; } + + return $result; } /**