public function adminAction() { $this->view->home = true; $this->view->tiny = true; $this->view->npbanners = $this->_siteConfig->npBannersEnabled(); if ($_POST['message']) { $orgs = array(); foreach ($_POST as $key => $value) { if (stristr($key, 'target')) { $p = explode('_', $key); $orgs[] = $p[1]; } } $emails = FM_Components_Organization::getMaillistOrgs($orgs); $allEmails = array(); $badChars = array('@', '.com', '.', '_', '-', ' ', ';', ':'); foreach ($emails as $key => $values) { if ($values['email'] != '') { $allEmails[strtolower(str_replace($badChars, '', $values['email']))]['email'] = $values['email']; } if ($values['uid'] != '') { $record = FM_Components_Member::getMemberRecord($values['uid']); $allEmails[strtolower(str_replace($badChars, '', $record['email']))]['email'] = $record['email']; } } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: administrator @ 4Monmouth.com' . "\r\n" . 'Reply-To: nobody@4monmouth.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $adminMessage = $_POST['message'] . "<br />The following users have been emailed : <pre>" . print_r(array_values($allEmails), true) . "</pre>"; mail('*****@*****.**', 'COPY OF: 4Monmouth.com : ' . $_POST['subject'], $adminMessage, $headers); foreach ($emails as $key => $value) { mail($value['email'], '4Monmouth.com : ' . $_POST['subject'], $_POST['message'], $headers); } } }