From 710c1555b77f257a7c63bcc4ea31f68afcf11a19 Mon Sep 17 00:00:00 2001 From: Jose Vasconcellos Date: Sat, 31 Mar 2018 15:18:41 -0500 Subject: [PATCH 1/2] Add support for other config['mailer'] options. Tested with sendmail. --- app/sprinkles/core/src/Mail/Mailer.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) mode change 100755 => 100644 app/sprinkles/core/src/Mail/Mailer.php diff --git a/app/sprinkles/core/src/Mail/Mailer.php b/app/sprinkles/core/src/Mail/Mailer.php old mode 100755 new mode 100644 index 5b346b46d..99d2dc6a1 --- a/app/sprinkles/core/src/Mail/Mailer.php +++ b/app/sprinkles/core/src/Mail/Mailer.php @@ -47,8 +47,23 @@ public function __construct($logger, $config = []) if (!in_array($config['mailer'], ['smtp', 'mail', 'qmail', 'sendmail'])) { throw new \phpmailerException("'mailer' must be one of 'smtp', 'mail', 'qmail', or 'sendmail'."); } - - if ($config['mailer'] == 'smtp') { +--- a/app/sprinkles/core/src/Mail/Mailer.php ++++ b/app/sprinkles/core/src/Mail/Mailer.php +@@ -44,11 +44,17 @@ class Mailer + + // Configuration options + if (isset($config['mailer'])) { + switch ($config['mailer']) { + case 'mail': + $this->phpMailer->isMail(); + break; + case 'qmail': + $this->phpMailer->isQmail(); + break; + case 'sendmail': + $this->phpMailer->isSendmail(); + break; + case 'smtp': $this->phpMailer->isSMTP(true); $this->phpMailer->Host = $config['host']; $this->phpMailer->Port = $config['port']; @@ -61,6 +76,9 @@ public function __construct($logger, $config = []) if (isset($config['smtp_options'])) { $this->phpMailer->SMTPOptions = $config['smtp_options']; } + break; + default: + throw new \phpmailerException("'mailer' must be one of 'smtp', 'mail', 'qmail', or 'sendmail'."); } // Set any additional message-specific options From ccda4012456f0ea7aec6f6b110805c5736d0f622 Mon Sep 17 00:00:00 2001 From: Jose Vasconcellos Date: Mon, 9 Apr 2018 03:34:30 -0500 Subject: [PATCH 2/2] Fix patch --- app/sprinkles/core/src/Mail/Mailer.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/sprinkles/core/src/Mail/Mailer.php b/app/sprinkles/core/src/Mail/Mailer.php index 99d2dc6a1..04f308f61 100644 --- a/app/sprinkles/core/src/Mail/Mailer.php +++ b/app/sprinkles/core/src/Mail/Mailer.php @@ -44,15 +44,6 @@ public function __construct($logger, $config = []) // Configuration options if (isset($config['mailer'])) { - if (!in_array($config['mailer'], ['smtp', 'mail', 'qmail', 'sendmail'])) { - throw new \phpmailerException("'mailer' must be one of 'smtp', 'mail', 'qmail', or 'sendmail'."); - } ---- a/app/sprinkles/core/src/Mail/Mailer.php -+++ b/app/sprinkles/core/src/Mail/Mailer.php -@@ -44,11 +44,17 @@ class Mailer - - // Configuration options - if (isset($config['mailer'])) { switch ($config['mailer']) { case 'mail': $this->phpMailer->isMail();