From 241726fa8abe73f7efab732f45c94c70e467f20b Mon Sep 17 00:00:00 2001 From: Isaac Niebeling Date: Tue, 22 Jul 2014 08:37:07 -0500 Subject: [PATCH] Add ability to have multiple email addresses --- core/components/formz/model/formz/formzhooks.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/components/formz/model/formz/formzhooks.class.php b/core/components/formz/model/formz/formzhooks.class.php index cf73fa7..e2e8cb7 100644 --- a/core/components/formz/model/formz/formzhooks.class.php +++ b/core/components/formz/model/formz/formzhooks.class.php @@ -105,7 +105,8 @@ public function dbSaveAndEmail() $newData['message'] .= $this->formArray[$field]['label'] . ' ' . $value . '
'; $newData[$this->formArray[$field]['id']] = $value; } - + + $emailToAddresses = explode(',', $this->config->emailTo); $message = $this->fmz->getChunk($this->config->emailTpl, $newData); $this->modx->getService('mail', 'mail.modPHPMailer'); @@ -113,7 +114,9 @@ public function dbSaveAndEmail() $this->modx->mail->set(modMail::MAIL_FROM, $this->config->emailFrom); $this->modx->mail->set(modMail::MAIL_FROM_NAME, $this->config->senderName); $this->modx->mail->set(modMail::MAIL_SUBJECT, $this->config->subject); - $this->modx->mail->address('to', $this->config->emailTo); + foreach($emailToAddresses as $address) { + $this->modx->mail->address('to', trim($address)); + } $this->modx->mail->address('reply-to', $this->config->emailFrom); $this->modx->mail->setHTML(true); if (!$this->modx->mail->send()) {