/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients) { $article = $this->article; $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO'); $journal =& Request::getJournal(); import('mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_COMMENT'); $email->setFrom($this->user->getEmail(), $this->user->getFullName()); $commentText = $this->getData('comments'); // Individually send an email to each of the recipients. foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => $commentText); $email->sendWithParams($paramArray); $email->clearRecipients(); } }