From 2a313eb971ab36e166308f7882897ef204234d0a Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 17 Nov 2017 14:46:23 -0800 Subject: Add the possibility to send tasks and comments to multiple recipients --- app/Controller/CommentMailController.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'app/Controller/CommentMailController.php') diff --git a/app/Controller/CommentMailController.php b/app/Controller/CommentMailController.php index 144c9a13..94947027 100644 --- a/app/Controller/CommentMailController.php +++ b/app/Controller/CommentMailController.php @@ -51,24 +51,25 @@ class CommentMailController extends BaseController protected function sendByEmail(array $values) { - $html = $this->template->render('comment_mail/email', array( - 'email' => $values, - )); + $html = $this->template->render('comment_mail/email', array('email' => $values)); + $emails = explode_csv_field($values['emails']); - $this->emailClient->send( - $values['email'], - $values['email'], - $values['subject'], - $html - ); + foreach ($emails as $email) { + $this->emailClient->send( + $email, + $email, + $values['subject'], + $html + ); + } } protected function prepareComment(array $values) { - $values['comment'] .= "\n\n_".t('Sent by email to [%s](mailto:%s) (%s)', $values['email'], $values['email'], $values['subject']).'_'; + $values['comment'] .= "\n\n_".t('Sent by email to "%s" (%s)', $values['emails'], $values['subject']).'_'; unset($values['subject']); - unset($values['email']); + unset($values['emails']); return $values; } -- cgit v1.2.3